package com.gb.demand.control;

import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gb.demand.common.dto.GoodClassBO;
import com.gb.demand.common.dto.GoodsBO;
import com.gb.demand.common.dto.Order;
import com.gb.demand.common.dto.OrderBO;
import com.gb.demand.common.entity.*;
import com.gb.demand.service.*;
import com.gb.demand.util.*;
import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Synchronized;
import lombok.extern.log4j.Log4j2;
import org.apache.logging.log4j.Logger;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.text.PDFTextStripper;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.net.URL;
import java.net.URLConnection;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import net.sourceforge.tess4j.*;

@RestController
@RequestMapping("/daochu")
@Log4j2
@Api(tags = "导出接口管理")
public class JianYuController {

    @PostMapping("/changsha")
    @ApiOperation(value = "添加长沙到大池 再到店铺")
    public void changsha() throws Exception {
        String filepath = "D:\\长沙轨道-40个 -3.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 12);
        for (int i = 0; i < dataList.size(); i++) {
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(5));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(6)).divide(new BigDecimal(0.74), 2));
            goods.setBarCode("0");
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(9));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20230720/" + dataList.get(i).get(0) + "-" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            Goodsbrand goodsbrand = new Goodsbrand().selectById(dataList.get(i).get(3));
            if (goodsbrand == null) {
                Goodsbrand goodsbrand1 = new Goodsbrand();
                goodsbrand1.setAddTime(new Date());
                goodsbrand1.setDeleteStatus(false);
                goodsbrand1.setAudit(true);
                goodsbrand1.setName(dataList.get(i).get(3));
                goodsbrand1.setRecommend(false);
                goodsbrand1.setSequence(1);
                goodsbrand1.setUserId(41210L);
                goodsbrand1.insert();
                goods.setGoodsBrandId(goodsbrand1.getId());
            } else {
                goods.setGoodsBrandId(Long.valueOf(dataList.get(i).get(3)));
            }
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setCode(dataList.get(i).get(4));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(11));
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "-1.jpg");
            accessory.setPath("uploadfile/store/32784/2023/07/20");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(7));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "-1.jpg");
                accessory1.setPath("uploadfile/store/32784/2023/07/20");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 2; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "-" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2023/07/20");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }
            //导入长沙店铺
            Goods oldgoods = new Goods().selectById(goods.getId());
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newGoods);
            newGoods.setDachiGoods(oldgoods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32843L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(newGoods.getId()));
            down1.insert();
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(2)));
            goodsUgc.insert();

            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(7));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "-1.jpg");
                accessory3.setPath("uploadfile/store/32784/2023/07/20");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(32811L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "-" + j + ".jpg");
                    accessory4.setPath("uploadfile/store/32784/2023/07/20");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(32811L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }
        }
    }

    @PostMapping("/huarun111")
    @ApiOperation(value = "添加老华润到大池 再到店铺")
    public void huarun111() throws Exception {
        String filepath = "D:\\第一批批量表格录入1.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 11);
        for (int i = 0; i < dataList.size(); i++) {
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(5));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setBarCode("0");
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(7)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setIsShow(1);
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(9));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/21240101/" + dataList.get(i).get(0) + "_" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            Goodsbrand goodsbrand = new Goodsbrand().selectById(dataList.get(i).get(3));
            if (goodsbrand == null) {
                Goodsbrand goodsbrand1 = new Goodsbrand();
                goodsbrand1.setAddTime(new Date());
                goodsbrand1.setDeleteStatus(false);
                goodsbrand1.setAudit(true);
                goodsbrand1.setName(dataList.get(i).get(3));
                goodsbrand1.setRecommend(false);
                goodsbrand1.setSequence(1);
                goodsbrand1.setUserId(41210L);
                goodsbrand1.insert();
                goods.setGoodsBrandId(goodsbrand1.getId());
            } else {
                goods.setGoodsBrandId(Long.valueOf(dataList.get(i).get(3)));
            }
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(7)));
            goods.setCode(dataList.get(i).get(4));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(10));
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "_1.jpg");
            accessory.setPath("uploadfile/store/32784/2124/01/01");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(8));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory1.setPath("uploadfile/store/32784/2124/01/01");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 2; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "_" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2124/01/01");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }
            Goods oldgoods = new Goods().selectById(goods.getId());
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newGoods);
            newGoods.setDachiGoods(oldgoods.getId());
            newGoods.setPhpid(-1L);
//            newGoods.setGuowangZhutuImg("123");
            newGoods.setGoodsStoreId(32872L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.setIsShow(0);
            newGoods.insert();
            System.out.println(i + "newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(newGoods.getId()));
            down1.insert();
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(2)));
            goodsUgc.insert();

            HrGoodsAttributeValue hrGoodsAttributeValue1 = new HrGoodsAttributeValue();
            hrGoodsAttributeValue1.setAddTime(new Date());
            hrGoodsAttributeValue1.setDeleteStatus(false);
            hrGoodsAttributeValue1.setGoodsId(newGoods.getId());
            hrGoodsAttributeValue1.setAttrbuteinfoId(111274);
            hrGoodsAttributeValue1.setAttId("000000000005");
            hrGoodsAttributeValue1.setAttrbute("723338");
            hrGoodsAttributeValue1.setAttrbuteinfoValueId("000000000003");
            hrGoodsAttributeValue1.setAttrName("销售单位");
            hrGoodsAttributeValue1.setAttrValue("件");
            hrGoodsAttributeValue1.insert();

            HrGoodsAttributeValue hrGoodsAttributeValue2 = new HrGoodsAttributeValue();
            hrGoodsAttributeValue2.setAddTime(new Date());
            hrGoodsAttributeValue2.setDeleteStatus(false);
            hrGoodsAttributeValue2.setGoodsId(newGoods.getId());
            hrGoodsAttributeValue2.setAttrbuteinfoId(111277);
            hrGoodsAttributeValue2.setAttId("000000000008");
            hrGoodsAttributeValue2.setAttrbute("723349");
            hrGoodsAttributeValue2.setAttrbuteinfoValueId("000000000014");
            hrGoodsAttributeValue2.setAttrName("税率");
            hrGoodsAttributeValue2.setAttrValue("13");
            hrGoodsAttributeValue2.insert();

            HrGoodsAttributeValue hrGoodsAttributeValue3 = new HrGoodsAttributeValue();
            hrGoodsAttributeValue3.setAddTime(new Date());
            hrGoodsAttributeValue3.setDeleteStatus(false);
            hrGoodsAttributeValue3.setGoodsId(newGoods.getId());
            hrGoodsAttributeValue3.setAttrbuteinfoId(111278);
            hrGoodsAttributeValue3.setAttId("000000000009");
            hrGoodsAttributeValue3.setAttrbute("723350");
            hrGoodsAttributeValue3.setAttrbuteinfoValueId("000000000015");
            hrGoodsAttributeValue3.setAttrName("币种");
            hrGoodsAttributeValue3.setAttrValue("人民币");
            hrGoodsAttributeValue3.insert();
            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(8));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory3.setPath("uploadfile/store/32784/2124/01/01");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(32811L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "_" + j + ".jpg");
                    accessory4.setPath("uploadfile/store/32784/2124/01/01");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(32811L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }

            //如果不为1就是还没添加过 需要推送消息
            if (!"1".equals(newGoods.getAppendixUrls())) {
                //添加商品池内商品消息
                HrMsg msg = new HrMsg();
                Date date = new Date();
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                String format = sdf.format(date);
                msg.setTime(format);
                msg.setType(6);
                msg.setStatus(1);
                msg.setStoreId(32872);
                Map maps = new HashMap();
                maps.put("spuId", newGoods.getId());
                List lists = new ArrayList();
                lists.add(newGoods.getId());
                maps.put("skuId", lists);
                GoodsUgc goodsUgcs = new GoodsUgc().selectOne(new LambdaQueryWrapper<GoodsUgc>().eq(GoodsUgc::getGoodsId, newGoods.getId()));
                Usergoodsclass usergoodsclasses = new Usergoodsclass().selectById(goodsUgcs.getClassId());
                maps.put("page_num", usergoodsclasses.getEpointid());
                maps.put("state", 1);
                msg.setResult(JSON.toJSONString(maps));
                msg.insert();
                //维护这个字段为已经添加
                newGoods.setAppendixUrls("1");
                newGoods.insertOrUpdate();
            }
        }
    }

    @PostMapping("/huarun222")
    @ApiOperation(value = "添加老华润到大池 再到店铺")
    public void huarun222() throws Exception {
        String filepath = "D:\\新华润批量模板.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 11);
        for (int i = 0; i < dataList.size(); i++) {
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(5));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setBarCode("0");
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(7)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setIsShow(1);
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(9));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20231011/" + dataList.get(i).get(0) + "-" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            Goodsbrand goodsbrand = new Goodsbrand().selectById(dataList.get(i).get(3));
            if (goodsbrand == null) {
                Goodsbrand goodsbrand1 = new Goodsbrand();
                goodsbrand1.setAddTime(new Date());
                goodsbrand1.setDeleteStatus(false);
                goodsbrand1.setAudit(true);
                goodsbrand1.setName(dataList.get(i).get(3));
                goodsbrand1.setRecommend(false);
                goodsbrand1.setSequence(1);
                goodsbrand1.setUserId(41210L);
                goodsbrand1.insert();
                goods.setGoodsBrandId(goodsbrand1.getId());
            } else {
                goods.setGoodsBrandId(Long.valueOf(dataList.get(i).get(3)));
            }
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(7)));
            goods.setCode(dataList.get(i).get(4));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(10));
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "-1.jpg");
            accessory.setPath("uploadfile/store/32784/2023/10/11");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(8));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "-1.jpg");
                accessory1.setPath("uploadfile/store/32784/2023/10/11");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 2; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "-" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2023/10/11");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }
            Goods oldgoods = new Goods().selectById(goods.getId());
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newGoods);
            newGoods.setDachiGoods(oldgoods.getId());
            newGoods.setPhpid(-1L);
//            newGoods.setGuowangZhutuImg("123");
            newGoods.setGoodsStoreId(32872L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.setIsShow(0);
            newGoods.insert();
            System.out.println(i + "newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(newGoods.getId()));
            down1.insert();
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(2)));
            goodsUgc.insert();

            HrGoodsAttributeValue hrGoodsAttributeValue1 = new HrGoodsAttributeValue();
            hrGoodsAttributeValue1.setAddTime(new Date());
            hrGoodsAttributeValue1.setDeleteStatus(false);
            hrGoodsAttributeValue1.setGoodsId(newGoods.getId());
            hrGoodsAttributeValue1.setAttrbuteinfoId(111274);
            hrGoodsAttributeValue1.setAttId("000000000005");
            hrGoodsAttributeValue1.setAttrbute("723338");
            hrGoodsAttributeValue1.setAttrbuteinfoValueId("000000000003");
            hrGoodsAttributeValue1.setAttrName("销售单位");
            hrGoodsAttributeValue1.setAttrValue("件");
            hrGoodsAttributeValue1.insert();

            HrGoodsAttributeValue hrGoodsAttributeValue2 = new HrGoodsAttributeValue();
            hrGoodsAttributeValue2.setAddTime(new Date());
            hrGoodsAttributeValue2.setDeleteStatus(false);
            hrGoodsAttributeValue2.setGoodsId(newGoods.getId());
            hrGoodsAttributeValue2.setAttrbuteinfoId(111277);
            hrGoodsAttributeValue2.setAttId("000000000008");
            hrGoodsAttributeValue2.setAttrbute("723349");
            hrGoodsAttributeValue2.setAttrbuteinfoValueId("000000000014");
            hrGoodsAttributeValue2.setAttrName("税率");
            hrGoodsAttributeValue2.setAttrValue("13");
            hrGoodsAttributeValue2.insert();

            HrGoodsAttributeValue hrGoodsAttributeValue3 = new HrGoodsAttributeValue();
            hrGoodsAttributeValue3.setAddTime(new Date());
            hrGoodsAttributeValue3.setDeleteStatus(false);
            hrGoodsAttributeValue3.setGoodsId(newGoods.getId());
            hrGoodsAttributeValue3.setAttrbuteinfoId(111278);
            hrGoodsAttributeValue3.setAttId("000000000009");
            hrGoodsAttributeValue3.setAttrbute("723350");
            hrGoodsAttributeValue3.setAttrbuteinfoValueId("000000000015");
            hrGoodsAttributeValue3.setAttrName("币种");
            hrGoodsAttributeValue3.setAttrValue("人民币");
            hrGoodsAttributeValue3.insert();
            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(8));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "-1.jpg");
                accessory3.setPath("uploadfile/store/32784/2023/10/11");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(32811L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "-" + j + ".jpg");
                    accessory4.setPath("uploadfile/store/32784/2023/10/11");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(32811L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }

            //如果不为1就是还没添加过 需要推送消息
            if (!"1".equals(newGoods.getAppendixUrls())) {
                //添加商品池内商品消息
                HrMsg msg = new HrMsg();
                Date date = new Date();
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                String format = sdf.format(date);
                msg.setTime(format);
                msg.setType(6);
                msg.setStatus(1);
                msg.setStoreId(32872);
                Map maps = new HashMap();
                maps.put("spuId", newGoods.getId());
                List lists = new ArrayList();
                lists.add(newGoods.getId());
                maps.put("skuId", lists);
                GoodsUgc goodsUgcs = new GoodsUgc().selectOne(new LambdaQueryWrapper<GoodsUgc>().eq(GoodsUgc::getGoodsId, newGoods.getId()));
                Usergoodsclass usergoodsclasses = new Usergoodsclass().selectById(goodsUgcs.getClassId());
                maps.put("page_num", usergoodsclasses.getEpointid());
                maps.put("state", 1);
                msg.setResult(JSON.toJSONString(maps));
                msg.insert();
                //维护这个字段为已经添加
                newGoods.setAppendixUrls("1");
                newGoods.insertOrUpdate();
            }
        }
    }

    @PostMapping("/shenzheng111")
    @Transactional
    @ApiOperation(value = "添加深圳到大池 再到店铺")
    public void shenzheng111() throws Exception {
        String filepath = "D:\\广博商品批量模板-for深圳阳光3.1.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 11);
        for (int i = 0; i < dataList.size(); i++) {
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(5));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setBarCode("0");
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(7)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(9));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20230808/" + dataList.get(i).get(0) + "-" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            Goodsbrand goodsbrand = new Goodsbrand().selectById(dataList.get(i).get(3));
            if (goodsbrand == null) {
                Goodsbrand goodsbrand1 = new Goodsbrand();
                goodsbrand1.setAddTime(new Date());
                goodsbrand1.setDeleteStatus(false);
                goodsbrand1.setAudit(true);
                goodsbrand1.setName(dataList.get(i).get(3));
                goodsbrand1.setRecommend(false);
                goodsbrand1.setSequence(1);
                goodsbrand1.setUserId(41210L);
                goodsbrand1.insert();
                goods.setGoodsBrandId(goodsbrand1.getId());
            } else {
                goods.setGoodsBrandId(Long.valueOf(dataList.get(i).get(3)));
            }
            goods.setGoodsStoreId(32894L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(7)));
            goods.setCode(dataList.get(i).get(4));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(10));
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "-1.jpg");
            accessory.setPath("uploadfile/store/32784/2023/08/08");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(8));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "-1.jpg");
                accessory1.setPath("uploadfile/store/32784/2023/08/08");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 2; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "-" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2023/08/08");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }
            Goods oldgoods = new Goods().selectById(goods.getId());
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newGoods);
            newGoods.setDachiGoods(oldgoods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32872L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(newGoods.getId()));
            down1.insert();
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(2)));
            goodsUgc.insert();
            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(8));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "-1.jpg");
                accessory3.setPath("uploadfile/store/32784/2023/08/08");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(32811L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "-" + j + ".jpg");
                    accessory4.setPath("uploadfile/store/32784/2023/08/08");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(32811L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }
        }
    }

    @PostMapping("/huarunpiliang")
    @ApiOperation(value = "华润批量")
    public void huarunpiliang() throws Exception {
        String piliang = "1885573,1885575,1885577,1885579,1885581,1885583,1885585,1885587,1885589,1885591,1885593,1885595,1885597,1885599,1885601,1885603,1885605,1885607,1885609,1885611,1885613,1885615,1885617,1885619,1885621,1885623,1885625,1885627,1885629,1885631,1885633,1885635,1885637,1885639,1885641,1885643,1885645,1885647,1885649,1885651,1885653,1885655,1885657,1885659,1885661,1885663,1885665,1885667,1885669,1885671,1885673,1885675,1885677,1885679,1885681,1885683,1885685,1885687,1885689,1885691,1885693,1885695,1885697,1885699,1885701,1885703,1885705,1885707,1885709,1885711,1885713,1885715,1885717,1885719,1885721,1885723,1885725,1885727,1885729,1885731,1885733";
        String[] split = piliang.split(",");
        List<String> ids = Arrays.asList(split);
        for (int i = 0; i < ids.size(); i++) {
            Map<String, String> header = new HashMap<>();
            header.put("Content-Type", "application/x-www-form-urlencoded");
            header.put("Cookie", "Hm_lvt_c200718a7e0f28eeb3343851eaef5f23=1668752197,1669075874,1669076042,1669341310; JSESSIONID=108DD7ADCC8E12BA14B03C0C11261B19; Hm_lpvt_c200718a7e0f28eeb3343851eaef5f23=1669947478");
            Map maps = new HashMap<>();
            maps.put("goods_id", ids.get(i));
            maps.put("updateType", 1);
//            String jsonMap = JSON.toJSONString(maps);
            String body = HttpRequest.post("https://btob.guangbo.net/seller/sendHuaRun.htm")
                    .headerMap(header, true)
                    .form(maps).execute().body();
            System.out.println(body);
        }
    }


    @PostMapping("/henan1")
    @ApiOperation(value = "河南改价")
    public void henan1() throws Exception {
        String filepath = "D:\\改价格.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(1)));
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(1)));
            goods.insertOrUpdate();
            System.out.println(goods.getId());
            Map map = new HashMap();
            map.put("sku", goods.getId());
            HnMsg hnMsg = new HnMsg();
            String result = JSON.toJSONString(map);
            hnMsg.setType(4);
            hnMsg.setAddTime(new Date());
            hnMsg.setResult(result);
            hnMsg.insert();
        }
    }

    @PostMapping("/henan2")
    @ApiOperation(value = "河南下架")
    public void henan2() throws Exception {
        String filepath = "D:\\下架.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            goods.setGoodsStatus(1);
            goods.insertOrUpdate();
            System.out.println(goods.getId());
            Map map = new HashMap();
            map.put("sku", goods.getId());
            HnMsg hnMsg = new HnMsg();
            String result = JSON.toJSONString(map);
            hnMsg.setType(6);
            hnMsg.setAddTime(new Date());
            hnMsg.setResult(result);
            hnMsg.insert();
        }
    }

    @PostMapping("/gai")
    @Transactional
    @ApiOperation(value = "加到大池")
    public void gai() throws Exception {
        List<down> downs = new down().selectAll();
        for (down d : downs) {
            Goods goods = new Goods().selectById(d.getId());
            goods.setGoodsStatus(1);
            goods.setUpTime(new Date());
            goods.insertOrUpdate();
            System.out.println(goods.getId());
        }
    }

    @PostMapping("/todachitosuzhou")
    @ApiOperation(value = "添加苏州到大池 再到店铺")
    @Transactional
    public void todachitosuzhou() throws Exception {
        String filepath = "D:\\苏州导入334.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 13);
        for (int i = 1; i < dataList.size(); i++) {
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(4));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setBarCode(dataList.get(i).get(7));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(5)));
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(10)));
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(10)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            goods.setJdUrl(dataList.get(i).get(12));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(9));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20220602/" + dataList.get(i).get(0) + "_" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                    .eq(Goodsbrand::getName, dataList.get(i).get(11)).eq(Goodsbrand::getUserId, 32326));
            if (goodsbrands.size() < 1) {
                Goodsbrand goodsbrand = new Goodsbrand();
                goodsbrand.setDeleteStatus(false);
                goodsbrand.setAudit(true);
                goodsbrand.setName(dataList.get(i).get(11));
                goodsbrand.setUserId(42326L);
                goodsbrand.setRecommend(false);
                goodsbrand.setSequence(1);
                goodsbrand.insert();
                goods.setGoodsBrandId(goodsbrand.getId());
            } else {
                goods.setGoodsBrandId(goodsbrands.get(i).getId());
            }
            goods.setGoodsStoreId(32784L);
            goods.setCode(dataList.get(i).get(3));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(6));
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("id:" + goods.getId());

            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "_1.jpg");
            accessory.setPath("uploadfile/store/32784/2022/06/02");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(8));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory1.setPath("uploadfile/store/32784/2022/06/02");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 2; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "_" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2022/06/02");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }
            //导入苏州店铺
            Goods oldgoods = new Goods().selectById(goods.getId());
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newGoods);
            newGoods.setDachiGoods(oldgoods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32846L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            down down = new down();
            down.setId(String.valueOf(newGoods.getId()));
            down.setMsg("suzhou");
            down.insert();

            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(2)));
            goodsUgc.insert();

            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(8));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory3.setPath("uploadfile/store/32784/2022/06/02");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(32811L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "_" + j + ".jpg");
                    accessory4.setPath("uploadfile/store/32784/2022/06/02");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(32811L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }
        }
    }

    @PostMapping("/gwtosuzhou")
    @ApiOperation(value = "复制国网的到苏州")
    public void gwtosuzhou() throws Exception {
        String filepath = "D:\\复制到苏州超市-(1).xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 5);
        for (int i = 1; i < dataList.size(); i++) {
            //导入苏州店铺
            Goods oldgoods = new Goods().selectById(new BigDecimal(dataList.get(i).get(0)));
            Goods dachiGoods = new Goods().selectById(oldgoods.getDachiGoods());
            if (dachiGoods == null) {
                down down = new down();
                down.setId(String.valueOf(oldgoods.getId()));
                down.setMsg("suzhou,大池id不对");
                down.insert();
            } else {
                dachiGoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(2)));
                dachiGoods.setStorePrice(new BigDecimal(dataList.get(i).get(2)));
                dachiGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(2)));
                dachiGoods.insertOrUpdate();
                Goods newGoods = new Goods();
                BeanUtils.copyProperties(dachiGoods, newGoods);
                newGoods.setDachiGoods(dachiGoods.getId());
                newGoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(2)));
                newGoods.setStorePrice(new BigDecimal(dataList.get(i).get(3)));
                newGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(3)));
                newGoods.setGoodsName(dataList.get(i).get(1));
                newGoods.setPhpid(-1L);
                newGoods.setGoodsStoreId(32846L);
                newGoods.setId(null);
                newGoods.setGoodsStatus(0);
                newGoods.setAddTime(new Date());
                newGoods.insert();
                System.out.println("newid:" + newGoods.getId());
                down down = new down();
                down.setId(String.valueOf(newGoods.getId()));
                down.setMsg("suzhou");
                down.insert();

                //设置分类
                GoodsUgc goodsUgc = new GoodsUgc();
                goodsUgc.setGoodsId(newGoods.getId());
                goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(4)));
                goodsUgc.insert();
            }
        }
    }

    @PostMapping("/gwtosuzhou1")
    @ApiOperation(value = "复制国网的到苏州")
    public void gwtosuzhou1() throws Exception {
        String filepath = "D:\\复制到苏州超市-(1).xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 5);
        for (int i = 0; i < dataList.size(); i++) {
            //导入苏州店铺
            Goods oldgoods = new Goods().selectById(new BigDecimal(dataList.get(i).get(0)));
            Goods dachiGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, dachiGoods);
            dachiGoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(2)));
            dachiGoods.setStorePrice(new BigDecimal(dataList.get(i).get(2)));
            dachiGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(2)));
            dachiGoods.setGoodsName(dataList.get(i).get(1));
            dachiGoods.setPhpid(-1L);
            dachiGoods.setGoodsStoreId(32784L);
            dachiGoods.setId(null);
            dachiGoods.setGoodsStatus(0);
            dachiGoods.setAddTime(new Date());
            dachiGoods.insert();
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(dachiGoods, newGoods);
            newGoods.setDachiGoods(dachiGoods.getId());
            newGoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(2)));
            newGoods.setStorePrice(new BigDecimal(dataList.get(i).get(3)));
            newGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(3)));
            newGoods.setGoodsName(dataList.get(i).get(1));
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32846L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            down down = new down();
            down.setId(String.valueOf(newGoods.getId()));
            down.setMsg("suzhou");
            down.insert();

            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(4)));
            goodsUgc.insert();
        }
    }

    @PostMapping("/gwtosanhe")
    @ApiOperation(value = "复制国网的到三禾")
    public void gwtosanhe() throws Exception {
        String filepath = "D:\\123.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 1; i < dataList.size(); i++) {
            //导入苏州店铺
            Goods oldgoods = new Goods().selectById(new BigDecimal(dataList.get(i).get(0)));
            Goods dachiGoods = new Goods().selectById(oldgoods.getDachiGoods());
            if (dachiGoods == null) {
                down down = new down();
                down.setId(String.valueOf(oldgoods.getId()));
                down.setMsg("三禾,大池id不对");
                down.insert();
            } else {
                Goods newGoods = new Goods();
                BeanUtils.copyProperties(dachiGoods, newGoods);
                newGoods.setDachiGoods(dachiGoods.getId());
                newGoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(1)));
                newGoods.setStorePrice(new BigDecimal(dataList.get(i).get(1)));
                newGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(1)));
                newGoods.setPhpid(-1L);
                newGoods.setGoodsStoreId(32873L);
                newGoods.setId(null);
                newGoods.setGoodsStatus(0);
                newGoods.setAddTime(new Date());
                newGoods.insert();
                System.out.println("newid:" + newGoods.getId());
                down down = new down();
                down.setId(String.valueOf(newGoods.getId()));
                down.setMsg("sanhe");
                down.insert();
            }
        }
    }

    @PostMapping("/dachitohenan")
    @ApiOperation(value = "复制大池的到别的店铺")
    public void dachitosuzhou() throws Exception {
        String filepath = "D:\\阳光易购批量.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 3);
        for (int i = 0; i < dataList.size(); i++) {
            Goods oldgoods = new Goods().selectById(dataList.get(i).get(0));
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newGoods);
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32838L);
            newGoods.setDachiGoods(oldgoods.getId());
//            newGoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(3)));
            newGoods.setStorePrice(new BigDecimal(dataList.get(i).get(2)));
            newGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(2)));
//            newGoods.setGoodsName(dataList.get(i).get(2));
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(1)));
            goodsUgc.insert();
            List<GoodsPhoto> goodsPhotos = new GoodsPhoto().selectList(new LambdaQueryWrapper<GoodsPhoto>()
                    .eq(GoodsPhoto::getGoodsId, oldgoods.getId()));
            for (GoodsPhoto goodsPhoto : goodsPhotos) {
                GoodsPhoto photo = new GoodsPhoto();
                photo.setGoodsId(newGoods.getId());
                photo.setPhotoId(goodsPhoto.getPhotoId());
                photo.insert();
            }
            down down = new down();
            down.setId(String.valueOf(newGoods.getId()));
            down.setMsg("henan");
            down.insert();
        }
    }

    @PostMapping("/suzhoutodachitosuzhou")
    @ApiOperation(value = "复制苏州的到大池再到苏州")
    public void suzhoutodachitosuzhou() throws Exception {
        String filepath = "D:\\苏州商品复制 - 副本.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 5);
        for (int i = 1; i < dataList.size(); i++) {
            Goods oldgoods = new Goods().selectById(dataList.get(i).get(0));
            Goods dachigoods = new Goods().selectById(oldgoods.getDachiGoods());
            dachigoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(3)));
            dachigoods.setStorePrice(new BigDecimal(dataList.get(i).get(3)));
            dachigoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(3)));
            dachigoods.insertOrUpdate();
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                    .eq(Goodsbrand::getName, dataList.get(i).get(4)).eq(Goodsbrand::getUserId, 42326));
            Goodsbrand gb = null;
            if (goodsbrands.size() < 1) {
                Goodsbrand goodsbrand = new Goodsbrand();
                goodsbrand.setDeleteStatus(false);
                goodsbrand.setAudit(true);
                goodsbrand.setName(dataList.get(i).get(4));
                goodsbrand.setUserId(42326L);
                goodsbrand.setRecommend(false);
                goodsbrand.setSequence(1);
                goodsbrand.insert();
                gb = goodsbrand;
            } else {
                gb = goodsbrands.get(0);
            }
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", dachigoods.getGoodsSafeInventory().toString());
            map.put("price", dachigoods.getStorePrice().toString());
            map.put("count", dachigoods.getGoodsInventory().toString());
            map.put("barcode", dachigoods.getBarCode() == null ? 0 : dachigoods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", dachigoods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            dachigoods.setGoodsInventoryDetail(s);
            dachigoods.insertOrUpdate();
            List<GoodsPhoto> goodsPhotos = new GoodsPhoto().selectList(new LambdaQueryWrapper<GoodsPhoto>()
                    .eq(GoodsPhoto::getGoodsId, oldgoods.getId()));
            Goods newsuzhouGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newsuzhouGoods);
            newsuzhouGoods.setPhpid(-1L);
            newsuzhouGoods.setGoodsStoreId(32846L);
            newsuzhouGoods.setDachiGoods(dachigoods.getId());
            newsuzhouGoods.setId(null);
            newsuzhouGoods.setGoodsBrandId(gb.getId());
            newsuzhouGoods.setGoodsName(dataList.get(i).get(1));
            newsuzhouGoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(3)));
            newsuzhouGoods.setStorePrice(new BigDecimal(dataList.get(i).get(2)));
            newsuzhouGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(2)));
            newsuzhouGoods.setGoodsStatus(0);
            newsuzhouGoods.setAddTime(new Date());
            newsuzhouGoods.insert();
            for (GoodsPhoto goodsPhoto : goodsPhotos) {
                GoodsPhoto photo = new GoodsPhoto();
                photo.setGoodsId(newsuzhouGoods.getId());
                photo.setPhotoId(goodsPhoto.getPhotoId());
                photo.insert();
            }
            List<GoodsUgc> goodsUgcs = new GoodsUgc().selectList(new LambdaQueryWrapper<GoodsUgc>()
                    .eq(GoodsUgc::getGoodsId, oldgoods.getId()));
            for (GoodsUgc goodsUgc : goodsUgcs) {
                GoodsUgc ugc = new GoodsUgc();
                ugc.setGoodsId(newsuzhouGoods.getId());
                ugc.setClassId(goodsUgc.getClassId());
                ugc.insert();
            }
            down down = new down();
            down.setId(dataList.get(i).get(0));
            down.setMsg("suzhou");
            down.setGid(String.valueOf(newsuzhouGoods.getId()));
            down.insert();
        }
    }

    @PostMapping("/suzhoutosuzhou")
    @ApiOperation(value = "复制苏州的到大池再到苏州")
    public void suzhoutosuzhou() throws Exception {
        String filepath = "D:\\工作簿4.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 1);
        for (int i = 0; i < dataList.size(); i++) {
            Goods oldgoods = new Goods().selectById(dataList.get(i).get(0));
            List<GoodsPhoto> goodsPhotos = new GoodsPhoto().selectList(new LambdaQueryWrapper<GoodsPhoto>()
                    .eq(GoodsPhoto::getGoodsId, oldgoods.getId()));
            Goods newsuzhouGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newsuzhouGoods);
            newsuzhouGoods.setPhpid(-1L);
            newsuzhouGoods.setGoodsStoreId(32784L);
            newsuzhouGoods.setId(null);
            newsuzhouGoods.setGoodsStatus(0);
            newsuzhouGoods.setAddTime(new Date());
            newsuzhouGoods.insert();
            for (GoodsPhoto goodsPhoto : goodsPhotos) {
                GoodsPhoto photo = new GoodsPhoto();
                photo.setGoodsId(newsuzhouGoods.getId());
                photo.setPhotoId(goodsPhoto.getPhotoId());
                photo.insert();
            }
            oldgoods.setDachiGoods(newsuzhouGoods.getId());
            oldgoods.insertOrUpdate();
            System.out.println(newsuzhouGoods.getId());
        }
    }

    @PostMapping("/othertosuzhou")
    @ApiOperation(value = "别的店铺复制到苏州")
    public void othertosuzhou() throws Exception {
        String filepath = "D:\\复制到苏州政采.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 6);
        for (int i = 0; i < dataList.size(); i++) {
            Goods oldgoods = new Goods().selectById(dataList.get(i).get(0));
            Goods dachigoods = new Goods().selectById(oldgoods.getDachiGoods());
            if (dachigoods == null) {
                System.out.println(dataList.get(i).get(0));
                continue;
            }
            dachigoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(4)));
            dachigoods.setStorePrice(new BigDecimal(dataList.get(i).get(4)));
            dachigoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(4)));
            dachigoods.insertOrUpdate();
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                    .eq(Goodsbrand::getName, dataList.get(i).get(2)).eq(Goodsbrand::getUserId, 42326));
            Goodsbrand gb = null;
            if (goodsbrands.size() < 1) {
                Goodsbrand goodsbrand = new Goodsbrand();
                goodsbrand.setDeleteStatus(false);
                goodsbrand.setAudit(true);
                goodsbrand.setName(dataList.get(i).get(2));
                goodsbrand.setUserId(42326L);
                goodsbrand.setRecommend(false);
                goodsbrand.setSequence(1);
                goodsbrand.insert();
                gb = goodsbrand;
            } else {
                gb = goodsbrands.get(0);
            }
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", dachigoods.getGoodsSafeInventory().toString());
            map.put("price", dachigoods.getStorePrice().toString());
            map.put("count", dachigoods.getGoodsInventory().toString());
            map.put("barcode", dachigoods.getBarCode() == null ? 0 : dachigoods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", dachigoods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            dachigoods.setGoodsInventoryDetail(s);
            dachigoods.insertOrUpdate();
            List<GoodsPhoto> goodsPhotos = new GoodsPhoto().selectList(new LambdaQueryWrapper<GoodsPhoto>()
                    .eq(GoodsPhoto::getGoodsId, oldgoods.getId()));
            Goods newsuzhouGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newsuzhouGoods);
            newsuzhouGoods.setPhpid(-1L);
            newsuzhouGoods.setGoodsStoreId(32846L);
            newsuzhouGoods.setDachiGoods(dachigoods.getId());
            newsuzhouGoods.setId(null);
            newsuzhouGoods.setGoodsBrandId(gb.getId());
            newsuzhouGoods.setGoodsName(dataList.get(i).get(3));
            newsuzhouGoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(4)));
            newsuzhouGoods.setStorePrice(new BigDecimal(dataList.get(i).get(5)));
            newsuzhouGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(5)));
            newsuzhouGoods.setGoodsStatus(0);
            newsuzhouGoods.setAddTime(new Date());
            newsuzhouGoods.insert();
            for (GoodsPhoto goodsPhoto : goodsPhotos) {
                GoodsPhoto photo = new GoodsPhoto();
                photo.setGoodsId(newsuzhouGoods.getId());
                photo.setPhotoId(goodsPhoto.getPhotoId());
                photo.insert();
            }
            GoodsUgc ugc = new GoodsUgc();
            ugc.setGoodsId(newsuzhouGoods.getId());
            ugc.setClassId(Long.valueOf(dataList.get(i).get(1)));
            ugc.insert();
            down down = new down();
            down.setId(dataList.get(i).get(0));
            down.setMsg("suzhou");
            down.setGid(String.valueOf(newsuzhouGoods.getId()));
            down.insert();
        }
    }

    @PostMapping("/gaifenlei")
    @ApiOperation(value = "改分类")
    public void gaifenlei() throws Exception {
        String filepath = "D:\\MROC测试.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            Goods oldgoods = new Goods().selectById(dataList.get(i).get(0));
            boolean delete = new GoodsUgc().delete(new LambdaQueryWrapper<GoodsUgc>()
                    .eq(GoodsUgc::getGoodsId, oldgoods.getId()));
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(oldgoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(1)));
            goodsUgc.insert();
            System.out.println(i);
        }
    }

    @PostMapping("/dachitohuazhong")
    @ApiOperation(value = "复制大池的到华中")
    public void dachitohuazhong() throws Exception {
        String filepath = "D:\\1.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 3);
        for (int i = 237; i < dataList.size(); i++) {
            //导入苏州店铺
            Goods oldgoods = new Goods().selectById(new BigDecimal(dataList.get(i).get(0)));
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newGoods);
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32839L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setDachiGoods(oldgoods.getId());
            newGoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(2)));
            newGoods.setStorePrice(new BigDecimal(dataList.get(i).get(2)));
            newGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(2)));
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            down down = new down();
            down.setId(String.valueOf(newGoods.getId()));
            down.setMsg("suzhou");
            down.insert();
            List<GoodsPhoto> goodsPhotos = new GoodsPhoto().selectList(new LambdaQueryWrapper<GoodsPhoto>().eq(GoodsPhoto::getGoodsId, oldgoods.getId()));
            if (goodsPhotos.size() > 0) {
                for (GoodsPhoto goodsPhoto : goodsPhotos) {
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(goodsPhoto.getPhotoId());
                    goodsPhoto1.insert();
                }
            }
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(1)));
            goodsUgc.insert();
        }
    }

    @PostMapping("/dachitojiangsu")
    @ApiOperation(value = "复制大池的到江苏")
    public void dachitojiangsu() throws Exception {
        String filepath = "D:\\广博103个.xls";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            Goods oldgoods = new Goods().selectById(new BigDecimal(dataList.get(i).get(0)));
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newGoods);
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32891L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setDachiGoods(oldgoods.getId());
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            down down = new down();
            down.setId(String.valueOf(newGoods.getId()));
            down.setMsg("jiangsu");
            down.insert();
            List<GoodsPhoto> goodsPhotos = new GoodsPhoto().selectList(new LambdaQueryWrapper<GoodsPhoto>().eq(GoodsPhoto::getGoodsId, oldgoods.getId()));
            if (goodsPhotos.size() > 0) {
                for (GoodsPhoto goodsPhoto : goodsPhotos) {
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(goodsPhoto.getPhotoId());
                    goodsPhoto1.insert();
                }
            }
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(1)));
            goodsUgc.insert();
        }
    }

    @PostMapping("/guowangtozhongzhi")
    @ApiOperation(value = "复制国网的到中直")
    public void guowangtozhongzhi() throws Exception {
        String filepath = "D:\\国网-中直.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 4);
        for (int i = 0; i < dataList.size(); i++) {
            Goods oldgoods = new Goods().selectById(new BigDecimal(dataList.get(i).get(0)));
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newGoods);
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32892L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setDachiGoods(oldgoods.getId());
            newGoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(2)));
            newGoods.setStorePrice(new BigDecimal(dataList.get(i).get(3)));
            newGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(3)));
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            down down = new down();
            down.setId(String.valueOf(newGoods.getId()));
            down.setMsg("zhongzhi");
            down.insert();
            List<GoodsPhoto> goodsPhotos = new GoodsPhoto().selectList(new LambdaQueryWrapper<GoodsPhoto>().eq(GoodsPhoto::getGoodsId, oldgoods.getId()));
            if (goodsPhotos.size() > 0) {
                for (GoodsPhoto goodsPhoto : goodsPhotos) {
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(goodsPhoto.getPhotoId());
                    goodsPhoto1.insert();
                }
            }
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(1)));
            goodsUgc.insert();
        }
    }

    @PostMapping("/gaosu")
    @Transactional
    @ApiOperation(value = "添加湖南高速到大池 再到湖南高速（拿到高速的商品）")
    public void gaosu() throws Exception {
        String filepath = "D:\\湖南高速.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 15);
        for (int i = 0; i < dataList.size(); i++) {
            System.out.println("name:" + dataList.get(i).get(9));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(9));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(3)));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(3)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setGcId(67825L);
            goods.setGoodsDetails("<img src=\"https://btob.guangbo.net/uploadfile/all/image/20210629/"
                    + dataList.get(i).get(10) + "." + dataList.get(i).get(11) + "\" alt=\"\" />");
            //新增品牌并维护
            Goodsbrand goodsbrand = new Goodsbrand();
            goodsbrand.setAddTime(new Date());
            goodsbrand.setDeleteStatus(false);
            goodsbrand.setAudit(true);
            goodsbrand.setName(dataList.get(i).get(4));
            goodsbrand.setRecommend(false);
            goodsbrand.setSequence(1);
            goodsbrand.insert();

            goods.setGoodsBrandId(goodsbrand.getId());
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(3)));
            goods.setCode(dataList.get(i).get(5));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(14));
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("id:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt(dataList.get(i).get(11));
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(10) + "." + dataList.get(i).get(11));
            accessory.setPath("uploadfile/store/32784/2021/06/29");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();
            //创建图片商品中间表
            GoodsPhoto goodsPhoto = new GoodsPhoto();
            goodsPhoto.setGoodsId(goods.getId());
            goodsPhoto.setPhotoId(accessory.getId());
            goodsPhoto.insert();

            //导入湖南高速店铺
            Goods oldgoods = new Goods().selectById(goods.getId());
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newGoods);
            newGoods.setDachiGoods(oldgoods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32848L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setGwTaxSortCode(dataList.get(i).get(1));
            newGoods.setGwTaxSortName(dataList.get(i).get(2));
            newGoods.setGoodsguid(dataList.get(i).get(0));
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            Usergoodsclass usergoodsclass = new Usergoodsclass().selectOne(new LambdaQueryWrapper<Usergoodsclass>()
                    .eq(Usergoodsclass::getUserId, 42472).eq(Usergoodsclass::getClassName, dataList.get(i).get(8)));
            goodsUgc.setClassId(usergoodsclass.getId());
            goodsUgc.insert();
        }
    }

    @PostMapping("/hunan")
    @Transactional
    @ApiOperation(value = "添加湖南高速到大池 再到湖南高速")
    public void hunan() throws Exception {
        String filepath = "D:\\湖南高速上架增加 - 广博.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 12);
        System.out.println("dataList:" + dataList);
        for (int i = 0; i < dataList.size(); i++) {
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(5));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            goods.setGoodsDetails("<img src=\"https://btob.guangbo.net/uploadfile/all/image/20211130/"
                    + dataList.get(i).get(7) + "." + dataList.get(i).get(8) + "\" alt=\"\" /><img src=\"https://btob.guangbo.net/uploadfile/all/image/20211130/"
                    + dataList.get(i).get(9) + "." + dataList.get(i).get(10) + "\" alt=\"\" />");
            Goodsbrand goodsbrands = new Goodsbrand().selectById(dataList.get(i).get(3));
            goods.setGoodsBrandId(goodsbrands.getId());
            //维护freeparam字段
            List list1 = new ArrayList();
            Map map1 = new HashMap();
            map1.put("paramName", "品牌");
            map1.put("paramValue", goodsbrands.getName());
            map1.put("paramType", "String");
            list1.add(map1);
            String freeparam = JsonUtils.obj2string(list1);
            goods.setFreeparam(freeparam);
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setCode(dataList.get(i).get(4));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(11));
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            System.out.println(dataList.get(i).get(5));
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("id:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt(dataList.get(i).get(8));
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(7) + "." + dataList.get(i).get(8));
            accessory.setPath("uploadfile/store/32784/2021/11/30");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();
            //创建图片商品中间表
            GoodsPhoto goodsPhoto = new GoodsPhoto();
            goodsPhoto.setGoodsId(goods.getId());
            goodsPhoto.setPhotoId(accessory.getId());
            goodsPhoto.insert();
            Accessory accessory1 = new Accessory();
            accessory1.setAddTime(new Date());
            accessory1.setDeleteStatus(false);
            accessory1.setSize(Float.valueOf(0));
            accessory1.setExt(dataList.get(i).get(10));
            accessory1.setHeight(800);
            accessory1.setName(dataList.get(i).get(9) + "." + dataList.get(i).get(10));
            accessory1.setPath("uploadfile/store/32784/2021/11/30");
            accessory1.setWidth(800);
            accessory1.setAlbumId(39L);
            accessory1.setUserId(32811L);
            accessory1.insert();
            //创建图片商品中间表
            GoodsPhoto goodsPhoto1 = new GoodsPhoto();
            goodsPhoto1.setGoodsId(goods.getId());
            goodsPhoto1.setPhotoId(accessory1.getId());
            goodsPhoto1.insert();
            //导入湖南高速店铺
            Goods oldgoods = new Goods().selectById(goods.getId());
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newGoods);
            newGoods.setDachiGoods(oldgoods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32848L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(1);
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(2)));
            goodsUgc.insert();
        }
    }

    @PostMapping("/huaruntohuarun")
    @ApiOperation(value = "复制老华润的到新华润")
    public void huaruntohuarun() throws Exception {
        String filepath = "D:\\MROC测试(2).xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 4);
        for (int i = 0; i < dataList.size(); i++) {
            Goods oldgoods = new Goods().selectById(dataList.get(i).get(0));
            List<GoodsPhoto> goodsPhotos = new GoodsPhoto().selectList(new LambdaQueryWrapper<GoodsPhoto>()
                    .eq(GoodsPhoto::getGoodsId, oldgoods.getId()));
            Goods newsuzhouGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newsuzhouGoods);
            newsuzhouGoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(2)));
            newsuzhouGoods.setStorePrice(new BigDecimal(dataList.get(i).get(3)));
            newsuzhouGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(3)));
            newsuzhouGoods.setPhpid(-1L);
            newsuzhouGoods.setGoodsStoreId(32872L);
            newsuzhouGoods.setId(null);
            newsuzhouGoods.setGoodsStatus(0);
            newsuzhouGoods.setAddTime(new Date());
            newsuzhouGoods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", newsuzhouGoods.getGoodsSafeInventory().toString());
            map.put("price", newsuzhouGoods.getStorePrice().toString());
            map.put("count", newsuzhouGoods.getGoodsInventory().toString());
            map.put("barcode", newsuzhouGoods.getBarCode() == null ? 0 : newsuzhouGoods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", newsuzhouGoods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            newsuzhouGoods.setGoodsInventoryDetail(s);
            newsuzhouGoods.insertOrUpdate();
            System.out.println("id:" + newsuzhouGoods.getId());
            for (GoodsPhoto goodsPhoto : goodsPhotos) {
                GoodsPhoto photo = new GoodsPhoto();
                photo.setGoodsId(newsuzhouGoods.getId());
                photo.setPhotoId(goodsPhoto.getPhotoId());
                photo.insert();
            }
            GoodsUgc ugc = new GoodsUgc();
            ugc.setGoodsId(newsuzhouGoods.getId());
            ugc.setClassId(Long.valueOf(dataList.get(i).get(1)));
            ugc.insert();
            down down = new down();
            down.setId(dataList.get(i).get(0));
            down.setMsg("xinhuarun");
            down.setGid(String.valueOf(newsuzhouGoods.getId()));
            down.insert();
        }
    }

    @PostMapping("/dachitohuadian")
    @ApiOperation(value = "复制大池到华电")
    public void dachitohuadian() throws Exception {
        String filepath = "D:\\华电905.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 3);
        for (int i = 0; i < dataList.size(); i++) {
            Goods oldgoods = new Goods().selectById(dataList.get(i).get(0));
            List<GoodsPhoto> goodsPhotos = new GoodsPhoto().selectList(new LambdaQueryWrapper<GoodsPhoto>()
                    .eq(GoodsPhoto::getGoodsId, oldgoods.getId()));
            Goods newsuzhouGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newsuzhouGoods);
            newsuzhouGoods.setStorePrice(new BigDecimal(dataList.get(i).get(2)));
            newsuzhouGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(2)));
            newsuzhouGoods.setGoodsStoreId(32900L);
            newsuzhouGoods.setDachiGoods(oldgoods.getId());
            newsuzhouGoods.setId(null);
            newsuzhouGoods.setGoodsStatus(0);
            newsuzhouGoods.setAddTime(new Date());
            newsuzhouGoods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", newsuzhouGoods.getGoodsSafeInventory().toString());
            map.put("price", newsuzhouGoods.getStorePrice().toString());
            map.put("count", newsuzhouGoods.getGoodsInventory().toString());
            map.put("barcode", newsuzhouGoods.getBarCode() == null ? 0 : newsuzhouGoods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", newsuzhouGoods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            newsuzhouGoods.setGoodsInventoryDetail(s);
            newsuzhouGoods.insertOrUpdate();
            System.out.println("id:" + newsuzhouGoods.getId());
            for (GoodsPhoto goodsPhoto : goodsPhotos) {
                GoodsPhoto photo = new GoodsPhoto();
                photo.setGoodsId(newsuzhouGoods.getId());
                photo.setPhotoId(goodsPhoto.getPhotoId());
                photo.insert();
            }
            GoodsUgc ugc = new GoodsUgc();
            ugc.setGoodsId(newsuzhouGoods.getId());
            ugc.setClassId(Long.valueOf(dataList.get(i).get(1)));
            ugc.insert();
            down down = new down();
            down.setId(dataList.get(i).get(0));
            down.setMsg("huadian");
            down.setGid(String.valueOf(newsuzhouGoods.getId()));
            down.insert();
        }
    }

    @GetMapping("xinzeng")
    @Transactional
    public void xinzeng() throws Exception {
        List<Zizhi> zizhis = new Zizhi().selectList(new LambdaQueryWrapper<Zizhi>().eq(Zizhi::getUrl, "3"));
        for (Zizhi zizhi : zizhis) {
            String id = zizhi.getId();
            //添加商品池内商品消息
            HrMsg msg = new HrMsg();
            Date date = new Date();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String format = sdf.format(date);
            msg.setTime(format);
            msg.setType(6);
            msg.setStatus(1);
            msg.setStoreId(32872);
            Map map = new HashMap();
            map.put("spuId", id);
            List list = new ArrayList();
            list.add(id);
            map.put("skuId", list);
            GoodsUgc goodsUgc = new GoodsUgc().selectOne(new LambdaQueryWrapper<GoodsUgc>().eq(GoodsUgc::getGoodsId, id));
            Usergoodsclass usergoodsclass = new Usergoodsclass().selectById(goodsUgc.getClassId());
            map.put("page_num", usergoodsclass.getEpointid());
            map.put("state", 1);
            msg.setResult(JSON.toJSONString(map));
            msg.insert();
            zizhi.setUrl(String.valueOf(4));
            zizhi.insertOrUpdate();
        }
    }

    @GetMapping("shangjia")
    public void shangjia() throws Exception {
        List<Zizhi> zizhis = new Zizhi().selectList(new LambdaQueryWrapper<Zizhi>().eq(Zizhi::getUrl, "4"));
        for (Zizhi zizhi : zizhis) {
            String id = zizhi.getId();
            //推送商品上下架变更消息
            HrMsg msg = new HrMsg();
            Date date = new Date();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String format = sdf.format(date);
            msg.setTime(format);
            msg.setType(4);
            msg.setStatus(1);
            msg.setStoreId(32872);
            Map map = new HashMap();
            map.put("skuId", id);
            msg.setResult(JSON.toJSONString(map));
            msg.insert();
            zizhi.setUrl(String.valueOf(5));
            zizhi.insertOrUpdate();
        }
    }


    @PostMapping("/pi")
    public void pi() throws Exception {
        String filepath = "D:\\（广博）2021上架产品表(1).xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 8);
        for (int i = 1; i < dataList.size(); i++) {
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(2));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(5)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setGcId(67733L);
            String detail = "";
            for (int j = 1; j <= 5; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20211009/" + dataList.get(i).get(0) + "-" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            Goodsbrand goodsbrand = new Goodsbrand();
            goodsbrand.setAddTime(new Date());
            goodsbrand.setDeleteStatus(false);
            goodsbrand.setAudit(true);
            goodsbrand.setName(dataList.get(i).get(1));
            goodsbrand.setRecommend(false);
            goodsbrand.setSequence(1);
            goodsbrand.setUserId(38227L);
            goodsbrand.insert();
            goods.setGoodsBrandId(goodsbrand.getId());
            goods.setGoodsStoreId(32829L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(5)));
            goods.setCode(dataList.get(i).get(3));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(7));
            //维护freeparam字段
            List list1 = new ArrayList();
            Map map1 = new HashMap();
            map1.put("paramName", "");
            map1.put("paramValue", "");
            map1.put("paramType", "String");
            list1.add(map1);
            String freeparam = JsonUtils.obj2string(list1);
            goods.setFreeparam(freeparam);
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "-1.jpg");
            accessory.setPath("uploadfile/store/32784/2021/10/09");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();
            Accessory accessory1 = new Accessory();
            accessory1.setAddTime(new Date());
            accessory1.setDeleteStatus(false);
            accessory1.setSize(Float.valueOf(0));
            accessory1.setExt("jpg");
            accessory1.setHeight(800);
            accessory1.setName(dataList.get(i).get(0) + "-2.jpg");
            accessory1.setPath("uploadfile/store/32784/2021/10/09");
            accessory1.setWidth(800);
            accessory1.setAlbumId(39L);
            accessory1.setUserId(32811L);
            accessory1.insert();
            //创建图片商品中间表
            GoodsPhoto goodsPhoto1 = new GoodsPhoto();
            goodsPhoto1.setGoodsId(goods.getId());
            goodsPhoto1.setPhotoId(accessory1.getId());
            goodsPhoto1.insert();
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(goods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(6)));
            goodsUgc.insert();
        }
    }

    @PostMapping("/guowangpinpai")
    public void guowangpinpai() throws Exception {
        String filepath = "D:\\浙江二级第二次推送.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 3);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                    .eq(Goodsbrand::getName, dataList.get(i).get(2))
                    .eq(Goodsbrand::getGuowangEpoint, dataList.get(i).get(1))
                    .eq(Goodsbrand::getUserId, 38255));
            if (goodsbrands.size() > 0) {
                goods.setGoodsBrandId(goodsbrands.get(0).getId());
                goods.insertOrUpdate();
            } else {
                Goodsbrand goodsbrand = new Goodsbrand();
                goodsbrand.setAddTime(new Date());
                goodsbrand.setDeleteStatus(false);
                goodsbrand.setAudit(true);
                goodsbrand.setName(dataList.get(i).get(2));
                goodsbrand.setRecommend(false);
                goodsbrand.setSequence(1);
                goodsbrand.setUserId(38255L);
                goodsbrand.setGuowangEpoint(dataList.get(i).get(1));
                goodsbrand.insert();
                goods.setGoodsBrandId(goodsbrand.getId());
                goods.insertOrUpdate();
            }
        }
    }

    @PostMapping("/pi2")
    public void pi2() throws Exception {
        String filepath = "D:\\广博华电调价清单 - 副本.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
//            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(1)));
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(1)));
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(1)));
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println(goods.getId());
        }
    }

    @PostMapping("/pi3")
    public void pi3() throws Exception {
        String filepath = "D:\\国网改价格.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 3);
        for (int i = 0; i < dataList.size(); i++) {
            Goods gwgoods = new Goods().selectById(dataList.get(i).get(0));
            Goods dcgoods = new Goods().selectById(dataList.get(i).get(1));
            dcgoods.setGoodsDetails(gwgoods.getGoodsDetails());
            dcgoods.setGoodsMainPhotoId(gwgoods.getGoodsMainPhotoId());
            dcgoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(2)));
            dcgoods.setStorePrice(new BigDecimal(dataList.get(i).get(2)));
            dcgoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(2)));
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", dcgoods.getGoodsSafeInventory().toString());
            map.put("price", dcgoods.getStorePrice().toString());
            map.put("count", dcgoods.getGoodsInventory().toString());
            map.put("barcode", dcgoods.getBarCode() == null ? 0 : dcgoods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", dcgoods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            dcgoods.setGoodsInventoryDetail(s);
            dcgoods.insertOrUpdate();
            new GoodsPhoto().delete(new LambdaQueryWrapper<GoodsPhoto>()
                    .eq(GoodsPhoto::getGoodsId, dcgoods.getId()));
            List<GoodsPhoto> goodsPhotos = new GoodsPhoto().selectList(new LambdaQueryWrapper<GoodsPhoto>()
                    .eq(GoodsPhoto::getGoodsId, gwgoods.getId()));
            for (GoodsPhoto goodsPhoto : goodsPhotos) {
                GoodsPhoto photo = new GoodsPhoto();
                photo.setGoodsId(dcgoods.getId());
                photo.setPhotoId(goodsPhoto.getPhotoId());
                photo.insert();
            }
            System.out.println(gwgoods.getId());
        }
    }

    @PostMapping("/pi4")
    public void pi4() throws Exception {
        List<Goods> goods = new Goods().selectList(new LambdaQueryWrapper<Goods>()
                .eq(Goods::getGoodsStoreId, 32836)
                .eq(Goods::getGoodsStatus, 0)
                .isNotNull(Goods::getCertEndTime).ne(Goods::getCertEndTime, ""));
        for (Goods good : goods) {
            System.out.println(good.getId());
        }
    }

    @PostMapping("/pi5")
    public void pi5() throws Exception {
        String filepath = "D:\\国网(2).xls";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 9);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(1)));
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(1)));
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(1)));
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGuowangZizhiImg(dataList.get(i).get(3));
            goods.setCertStartTime(dataList.get(i).get(4));
            goods.setCertEndTime(dataList.get(i).get(5));
            goods.setGoodsInventoryDetail(s);
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(7));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20230309/" + dataList.get(i).get(8) + "_" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(8) + "_1.jpg");
            accessory.setPath("uploadfile/store/32784/2023/03/09");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();
            new GoodsPhoto().delete(new LambdaQueryWrapper<GoodsPhoto>().eq(GoodsPhoto::getGoodsId, goods.getId()));

            Integer mainnum = Integer.valueOf(dataList.get(i).get(6));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(8) + "_1.jpg");
                accessory1.setPath("uploadfile/store/32784/2023/03/09");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 2; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(8) + "_" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2023/03/09");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }
            new GoodsUgc().delete(new LambdaQueryWrapper<GoodsUgc>().eq(GoodsUgc::getGoodsId, goods.getId()));
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(goods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(2)));
            goodsUgc.insert();
            System.out.println(goods.getId());
        }
    }

    @PostMapping("/pi6")
    public void pi6() throws Exception {
        String filepath = "D:\\吕尚批量重推.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 6);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(1)));
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(1)));
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(1)));
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGuowangZizhiImg(dataList.get(i).get(3));
            goods.setCertStartTime(dataList.get(i).get(4));
            goods.setCertEndTime(dataList.get(i).get(5));
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            new GoodsUgc().delete(new LambdaQueryWrapper<GoodsUgc>().eq(GoodsUgc::getGoodsId, goods.getId()));
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(goods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(2)));
            goodsUgc.insert();
            System.out.println(goods.getId());
        }
    }

    @PostMapping("/pi7")
    public void pi7() throws Exception {
        String filepath = "D:\\中直-国网.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 3);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            goods.setJdUrl(dataList.get(i).get(1));
            goods.setJdPrice(new BigDecimal(dataList.get(i).get(2)));
            goods.insertOrUpdate();
            System.out.println(goods.getId());
        }
    }


    @PostMapping("/shutupian")
    @ApiOperation(value = "数图片")
    public void shutupian() throws Exception {
        File file = new File("F:\\苏州图片\\suzhoumain");
        if (file.exists()) {
            File[] files = file.listFiles();
            for (File file2 : files) {
                if (file2.isDirectory()) {
                    System.out.println("文件夹:" + file2.getAbsolutePath());
                    File sum[] = file2.listFiles();
                    System.out.println("文件夹" + file2 + "的里面有" + sum.length + "张图片");
                    ShuTuPian shuTuPian = new ShuTuPian();
                    shuTuPian.setId(file2.getAbsolutePath());
                    shuTuPian.setMsg(String.valueOf(sum.length));
                    shuTuPian.insert();
                }
            }
        } else {
            System.out.println("文件不存在!");
        }
    }

    @PostMapping("/anhuishuian")
    @ApiOperation(value = "添加安徽水安商品到大池 再到店铺")
    public void anhuishuian() throws Exception {
        String filepath = "D:\\新建 XLS 工作表.xls";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 10);
        for (int i = 0; i < dataList.size(); i++) {
            System.out.println("num:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(5));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(5));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(8));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20230509/" + dataList.get(i).get(0) + "-" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                    .eq(Goodsbrand::getId, dataList.get(i).get(3)));
            if (goodsbrands.size() < 1) {
                Goodsbrand goodsbrand1 = new Goodsbrand();
                goodsbrand1.setAddTime(new Date());
                goodsbrand1.setDeleteStatus(false);
                goodsbrand1.setAudit(true);
                goodsbrand1.setName(dataList.get(i).get(3));
                goodsbrand1.setRecommend(false);
                goodsbrand1.setSequence(1);
                goodsbrand1.setUserId(32811L);
                goodsbrand1.insert();
                goods.setGoodsBrandId(goodsbrand1.getId());
            } else {
                goods.setGoodsBrandId(Long.valueOf(dataList.get(i).get(3)));
            }
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setCode(dataList.get(i).get(4));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(9));
            //维护freeparam字段
            List list1 = new ArrayList();
            Map map1 = new HashMap();
            map1.put("paramName", "型号");
            map1.put("paramValue", dataList.get(i).get(4));
            map1.put("paramType", "String");
            list1.add(map1);
            String freeparam = JsonUtils.obj2string(list1);
            goods.setFreeparam(freeparam);
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "-1.jpg");
            accessory.setPath("uploadfile/store/32784/2023/05/09");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(7));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "-1.jpg");
                accessory1.setPath("uploadfile/store/32784/2023/05/09");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 2; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "-" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2023/05/09");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }

            //添加国网商品从大池到店铺
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(goods, newGoods);
            newGoods.setDachiGoods(goods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32889L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(newGoods.getId()));
            down1.setMsg(String.valueOf(newGoods.getDachiGoods()));
            down1.insert();
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(2)));
            goodsUgc.insert();

            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(7));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "-1.jpg");
                accessory3.setPath("uploadfile/store/32784/2023/05/09");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(32811L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "-" + j + ".jpg");
                    accessory4.setPath("uploadfile/store/32784/2023/05/09");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(32811L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }

        }
    }

    @PostMapping("/henan")
    @ApiOperation(value = "添加河南商品到大池 再到店铺")
    public void henan() throws Exception {
        String filepath = "D:\\河南上架批量表.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 10);
        for (int i = 0; i < dataList.size(); i++) {
            System.out.println("num:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(5));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(5));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(8));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20230524/" + dataList.get(i).get(0) + "_" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                    .eq(Goodsbrand::getId, dataList.get(i).get(3)));
            if (goodsbrands.size() < 1) {
                Goodsbrand goodsbrand1 = new Goodsbrand();
                goodsbrand1.setAddTime(new Date());
                goodsbrand1.setDeleteStatus(false);
                goodsbrand1.setAudit(true);
                goodsbrand1.setName(dataList.get(i).get(3));
                goodsbrand1.setRecommend(false);
                goodsbrand1.setSequence(1);
                goodsbrand1.setUserId(32811L);
                goodsbrand1.insert();
                goods.setGoodsBrandId(goodsbrand1.getId());
            } else {
                goods.setGoodsBrandId(Long.valueOf(dataList.get(i).get(3)));
            }
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setCode(dataList.get(i).get(4));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(9));
            //维护freeparam字段
            List list1 = new ArrayList();
            Map map1 = new HashMap();
            map1.put("paramName", "型号");
            map1.put("paramValue", dataList.get(i).get(4));
            map1.put("paramType", "String");
            list1.add(map1);
            String freeparam = JsonUtils.obj2string(list1);
            goods.setFreeparam(freeparam);
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "_1.jpg");
            accessory.setPath("uploadfile/store/32784/2023/05/24");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(7));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory1.setPath("uploadfile/store/32784/2023/05/24");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 2; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "_" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2023/05/24");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }

            //添加国网商品从大池到店铺
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(goods, newGoods);
            newGoods.setDachiGoods(goods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32838L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(newGoods.getId()));
            down1.setMsg(String.valueOf(newGoods.getDachiGoods()));
            down1.insert();
            Map maps = new HashMap();
            maps.put("sku", newGoods.getId());
            HnMsg hnMsg = new HnMsg();
            String result = JSON.toJSONString(maps);
            hnMsg.setType(1);
            hnMsg.setAddTime(new Date());
            hnMsg.setResult(result);
            hnMsg.insert();
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(2)));
            goodsUgc.insert();

            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(7));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory3.setPath("uploadfile/store/32784/2023/05/24");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(32811L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "_" + j + ".jpg");
                    accessory4.setPath("uploadfile/store/32784/2023/05/24");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(32811L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }

        }
    }

    @PostMapping("/huaxia")
    @ApiOperation(value = "添加华夏商品到大池 再到店铺")
    public void huaxia() throws Exception {
        String filepath = "D:\\华夏上架模板.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 10);
        for (int i = 0; i < dataList.size(); i++) {
            System.out.println("num:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(5));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(5));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(8));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20221024/" + dataList.get(i).get(0) + "-" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            goods.setGoodsBrandId(Long.valueOf(dataList.get(i).get(3)));
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setCode(dataList.get(i).get(4));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(9));
            //维护freeparam字段
            List list1 = new ArrayList();
            Map map1 = new HashMap();
            map1.put("paramName", "型号");
            map1.put("paramValue", dataList.get(i).get(4));
            map1.put("paramType", "String");
            list1.add(map1);
            String freeparam = JsonUtils.obj2string(list1);
            goods.setFreeparam(freeparam);
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "-1.jpg");
            accessory.setPath("uploadfile/store/32784/2022/10/24");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(7));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "-1.jpg");
                accessory1.setPath("uploadfile/store/32784/2022/10/24");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 2; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "-" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2022/10/24");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }

            //添加国网商品从大池到店铺
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(goods, newGoods);
            newGoods.setDachiGoods(goods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32839L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(1);
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(newGoods.getId()));
            down1.setMsg(String.valueOf(newGoods.getDachiGoods()));
            down1.insert();
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(2)));
            goodsUgc.insert();

            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(7));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "-1.jpg");
                accessory3.setPath("uploadfile/store/32784/2022/10/24");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(32811L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "-" + j + ".jpg");
                    accessory4.setPath("uploadfile/store/32784/2022/10/24");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(32811L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }
        }
    }

    @PostMapping("/guowang")
    @ApiOperation(value = "添加国网商品到大池 再到店铺")
    public void guowang() throws Exception {
        String filepath = "D:\\国网新增2-6.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 26);
        for (int i = 0; i < dataList.size(); i++) {
            System.out.println("num:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(2));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(2));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(22)));
            goods.setBarCode(dataList.get(i).get(6));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(1);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(22)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setGcId(Long.valueOf(dataList.get(i).get(21)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(24));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20220516/" + dataList.get(i).get(0) + "_" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            goods.setGoodsBrandId(Long.valueOf(dataList.get(i).get(5)));
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(22)));
            goods.setCode(dataList.get(i).get(7));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(8));
            //维护freeparam字段
            List list1 = new ArrayList();
            Map map1 = new HashMap();
            map1.put("paramName", dataList.get(i).get(9));
            map1.put("paramValue", dataList.get(i).get(10));
            map1.put("paramType", "String");
            list1.add(map1);
            String freeparam = JsonUtils.obj2string(list1);
            goods.setFreeparam(freeparam);
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "_1.jpg");
            accessory.setPath("uploadfile/store/32784/2022/05/16");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(23));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory1.setPath("uploadfile/store/32784/2022/05/16");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 2; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "_" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2022/05/16");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }

            //添加国网商品从大池到店铺
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(goods, newGoods);
            newGoods.setDachiGoods(goods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32824L);
            newGoods.setGuowangSpuId(dataList.get(i).get(1));
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            //设置资质图片
            newGoods.setGuowangZizhiImg(dataList.get(i).get(25));
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(newGoods.getId()));
            down1.setMsg(String.valueOf(newGoods.getDachiGoods()));
            down1.insert();
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(4)));
            goodsUgc.insert();

            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(23));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory3.setPath("uploadfile/store/32784/2022/05/16");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(32811L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "_" + j + ".jpg");
                    accessory4.setPath("uploadfile/store/32784/2022/05/16");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(32811L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }

        }
    }

    @PostMapping("/chaxun")
    public void chaxun() throws Exception {
        String filepath = "D:\\1.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 1);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            List<Goodscart> goodscarts = new Goodscart().selectList(new LambdaQueryWrapper<Goodscart>()
                    .eq(Goodscart::getGoodsId, dataList.get(i).get(0)));
            if (goodscarts.size() < 1) {
                goods.setGoodsStatus(1);
                goods.insertOrUpdate();
                System.out.println(goods.getId());
            }
        }
    }

    @PostMapping("/sgerji")
    @ApiOperation(value = "添加省管二级的图片")
    public void sgerji() throws Exception {
        String filepath = "D:\\省管-二级浙江.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 5);
        for (int i = 1; i < dataList.size(); i++) {
            System.out.println("id:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(2));
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(4));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20220415/" + dataList.get(i).get(1) + "_" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            goods.insertOrUpdate();
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(1) + "_1.jpg");
            accessory.setPath("uploadfile/store/32784/2022/04/15");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(3));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(1) + "_1.jpg");
                accessory1.setPath("uploadfile/store/32784/2022/04/15");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 2; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(1) + "_" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2022/04/15");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }
        }
    }

    @PostMapping("/gaimingzi")
    @ApiOperation(value = "改名")
    @Transactional
    public void gaimingzi() throws Exception {
        String filepath = "D:\\昌贸改.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            goods.setGoodsName(dataList.get(i).get(1));
            goods.insertOrUpdate();
            Goods goods1 = new Goods().selectById(goods.getDachiGoods());
            goods1.setGoodsName(dataList.get(i).get(1));
            goods1.insertOrUpdate();
            System.out.println(goods.getId());
        }
    }

    @PostMapping("/todachitosanxia")
    @ApiOperation(value = "添加三峡到大池 再到店铺")
    @Transactional
    public void todachitosanxia() throws Exception {
        String filepath = "D:\\3.13三峡提报模板 .xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 16);
        for (int i = 0; i < dataList.size(); i++) {
            System.out.println("num:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(4));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(4));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(5)));
            goods.setBarCode(dataList.get(i).get(8));
            goods.setCode(dataList.get(i).get(3));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(5)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setJdUrl(dataList.get(i).get(12));
            goods.setJdPrice(new BigDecimal(dataList.get(i).get(13)));
            goods.setFinancialCode(dataList.get(i).get(14));
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(10));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20230825/" + dataList.get(i).get(0) + "_" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                    .eq(Goodsbrand::getName, dataList.get(i).get(11)).eq(Goodsbrand::getUserId, 32811));
            if (goodsbrands.size() < 1) {
                Goodsbrand goodsbrand1 = new Goodsbrand();
                goodsbrand1.setAddTime(new Date());
                goodsbrand1.setDeleteStatus(false);
                goodsbrand1.setAudit(true);
                goodsbrand1.setName(dataList.get(i).get(11));
                goodsbrand1.setRecommend(false);
                goodsbrand1.setSequence(1);
                goodsbrand1.setUserId(32811L);
                goodsbrand1.insert();
                goods.setGoodsBrandId(goodsbrand1.getId());
            } else {
                goods.setGoodsBrandId(goodsbrands.get(0).getId());
            }
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(5)));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(7));
            //维护freeparam字段
            List list123 = new ArrayList();
            Map map123 = new HashMap();
            map123.put("paramName", "area");
            map123.put("paramValue", dataList.get(i).get(15));
            map123.put("paramType", "String");
            list123.add(map123);
            String s123 = JsonUtils.obj2string(list123);
            goods.setFreeparam(s123);
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "_1.jpg");
            accessory.setPath("uploadfile/store/32784/2023/08/25");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(9));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory1.setPath("uploadfile/store/32784/2023/08/25");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 1; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "_" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2023/08/25");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }

            //导入三峡店铺
            Goods oldgoods = new Goods().selectById(goods.getId());
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newGoods);
            newGoods.setDachiGoods(oldgoods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32883L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.insert();

            System.out.println("newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(goods.getId()));
            down1.setMsg("sanxia");
            down1.setGid(String.valueOf(newGoods.getId()));
            down1.insert();
            ApiMessage apiMessage = new ApiMessage();
            apiMessage.setMessage(String.valueOf(newGoods.getId()));
            apiMessage.setIsDel(0);
            apiMessage.setType(1);
            apiMessage.setStoreId(32883);
            apiMessage.insert();

            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(2)));
            goodsUgc.insert();

            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(9));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory3.setPath("uploadfile/store/32784/2023/08/25");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(32811L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "_" + j + ".jpg");
                    accessory4.setPath("uploadfile/store/32784/2023/08/25");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(32811L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }

        }
    }


    @PostMapping("/todachitowangchun")
    @ApiOperation(value = "添加望春监狱到大池 再到店铺")
    @Transactional
    public void todachitowangchun() throws Exception {
        String filepath = "D:\\大池导入模版 - 副本(3).xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 16);
        for (int i = 0; i < dataList.size(); i++) {
            System.out.println("num:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(4));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(4));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(5)));
            goods.setBarCode(dataList.get(i).get(8));
            goods.setCode(dataList.get(i).get(3));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(5)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(10));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20221124/" + dataList.get(i).get(0) + "_" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                    .eq(Goodsbrand::getName, dataList.get(i).get(11)).eq(Goodsbrand::getUserId, 32811));
            if (goodsbrands.size() < 1) {
                Goodsbrand goodsbrand1 = new Goodsbrand();
                goodsbrand1.setAddTime(new Date());
                goodsbrand1.setDeleteStatus(false);
                goodsbrand1.setAudit(true);
                goodsbrand1.setName(dataList.get(i).get(11));
                goodsbrand1.setRecommend(false);
                goodsbrand1.setSequence(1);
                goodsbrand1.setUserId(32811L);
                goodsbrand1.insert();
                goods.setGoodsBrandId(goodsbrand1.getId());
            } else {
                goods.setGoodsBrandId(goodsbrands.get(0).getId());
            }
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(5)));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(7));
            //维护freeparam字段
            List list1 = new ArrayList();
            Map map1 = new HashMap();
            map1.put("paramName", dataList.get(i).get(12));
            map1.put("paramValue", dataList.get(i).get(13));
            map1.put("paramType", "String");
            list1.add(map1);
            Map map2 = new HashMap();
            map2.put("paramName", dataList.get(i).get(14));
            map2.put("paramValue", dataList.get(i).get(15));
            map2.put("paramType", "String");
            list1.add(map2);
            String freeparam = JsonUtils.obj2string(list1);
            goods.setFreeparam(freeparam);
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "_1.jpg");
            accessory.setPath("uploadfile/store/32784/2022/11/24");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(9));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory1.setPath("uploadfile/store/32784/2022/11/24");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 1; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "_" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2022/11/24");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }

            //导入三峡店铺
            Goods oldgoods = new Goods().selectById(goods.getId());
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newGoods);
            newGoods.setDachiGoods(oldgoods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32887L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.insert();

            System.out.println("newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(goods.getId()));
            down1.setMsg("wangchun");
            down1.setGid(String.valueOf(newGoods.getId()));
            down1.insert();

            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(2)));
            goodsUgc.insert();

            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(9));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory3.setPath("uploadfile/store/32784/2022/11/24");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(32811L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "_" + j + ".jpg");
                    accessory4.setPath("uploadfile/store/32784/2022/11/24");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(32811L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }

        }
    }

    @PostMapping("/todachitozhongdianjian")
    @ApiOperation(value = "添加中电建到大池 再到店铺")
    @Transactional
    public void todachitozhongdianjian() throws Exception {
        String filepath = "D:\\中电建上架(2).xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 14);
        for (int i = 0; i < dataList.size(); i++) {
            System.out.println("num:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(4));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(4));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(5)));
            goods.setBarCode(dataList.get(i).get(8));
            goods.setCode(dataList.get(i).get(3));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(5)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setJdUrl(dataList.get(i).get(12));
            goods.setJdPrice(new BigDecimal(dataList.get(i).get(13)));
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(10));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20220822/" + dataList.get(i).get(0) + "_" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                    .eq(Goodsbrand::getName, dataList.get(i).get(9)).eq(Goodsbrand::getUserId, 37843));
            if (goodsbrands.size() < 1) {
                Goodsbrand goodsbrand1 = new Goodsbrand();
                goodsbrand1.setAddTime(new Date());
                goodsbrand1.setDeleteStatus(false);
                goodsbrand1.setAudit(true);
                goodsbrand1.setName(dataList.get(i).get(11));
                goodsbrand1.setRecommend(false);
                goodsbrand1.setSequence(1);
                goodsbrand1.setUserId(37843L);
                goodsbrand1.insert();
                goods.setGoodsBrandId(goodsbrand1.getId());
            } else {
                goods.setGoodsBrandId(goodsbrands.get(0).getId());
            }
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(5)));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(7));
            //维护freeparam字段
            List list1 = new ArrayList();
            Map map1 = new HashMap();
            map1.put("paramName", "");
            map1.put("paramValue", "");
            map1.put("paramType", "String");
            list1.add(map1);
            String freeparam = JsonUtils.obj2string(list1);
            goods.setFreeparam(freeparam);
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "_1.jpg");
            accessory.setPath("uploadfile/store/32784/2022/08/22");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(37843L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(9));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory1.setPath("uploadfile/store/32784/2022/08/22");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(37843L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 1; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "_" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2022/08/22");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(37843L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }

            //导入三峡店铺
            Goods oldgoods = new Goods().selectById(goods.getId());
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newGoods);
            newGoods.setDachiGoods(oldgoods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32805L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.insert();

            System.out.println("newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(goods.getId()));
            down1.setMsg("zhongdianjian");
            down1.setGid(String.valueOf(newGoods.getId()));
            down1.insert();

            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(2)));
            goodsUgc.insert();

            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(9));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory3.setPath("uploadfile/store/32784/2022/08/22");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(37843L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "_" + j + ".jpg");
                    accessory4.setPath("uploadfile/store/32784/2022/08/22");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(37843L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }
        }
    }

    @PostMapping("/gaitupian")
    @ApiOperation(value = "改图片")
    public void gaitupian() throws Exception {
        String filepath = "D:\\123.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(1));
            String detail = "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20220822/" + dataList.get(i).get(0) + "_1.jpg\" alt=\"\" />";
            goods.setGoodsDetails(detail);
            new GoodsPhoto().delete(new LambdaQueryWrapper<GoodsPhoto>()
                    .eq(GoodsPhoto::getGoodsId, goods.getId()));
            Accessory accessory1 = new Accessory();
            accessory1.setAddTime(new Date());
            accessory1.setDeleteStatus(false);
            accessory1.setSize(Float.valueOf(0));
            accessory1.setExt("jpg");
            accessory1.setHeight(800);
            accessory1.setName(dataList.get(i).get(0) + "_1.jpg");
            accessory1.setPath("uploadfile/store/32784/2022/08/22");
            accessory1.setWidth(800);
            accessory1.setAlbumId(39L);
            accessory1.setUserId(32811L);
            accessory1.insert();
            goods.setGoodsMainPhotoId(accessory1.getId());
            goods.insertOrUpdate();
            //创建图片商品中间表
            GoodsPhoto goodsPhoto1 = new GoodsPhoto();
            goodsPhoto1.setGoodsId(goods.getId());
            goodsPhoto1.setPhotoId(accessory1.getId());
            goodsPhoto1.insert();
        }
    }

    @PostMapping("/todachitosxnh")
    @ApiOperation(value = "添加山西农行到大池 再到店铺")
    @Transactional
    public void todachitosxnh() throws Exception {
        String filepath = "D:\\大池导入模版 - 副本(1).xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 11);
        for (int i = 0; i < dataList.size(); i++) {
            System.out.println("num:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(3));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(3));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setBarCode(dataList.get(i).get(6));
            goods.setCode(dataList.get(i).get(2));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(8));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20230315/" + dataList.get(i).get(0) + "-" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                    .eq(Goodsbrand::getName, dataList.get(i).get(9)).eq(Goodsbrand::getUserId, 37843));
            if (goodsbrands.size() < 1) {
                Goodsbrand goodsbrand1 = new Goodsbrand();
                goodsbrand1.setAddTime(new Date());
                goodsbrand1.setDeleteStatus(false);
                goodsbrand1.setAudit(true);
                goodsbrand1.setName(dataList.get(i).get(9));
                goodsbrand1.setRecommend(false);
                goodsbrand1.setSequence(1);
                goodsbrand1.setUserId(37843L);
                goodsbrand1.insert();
                goods.setGoodsBrandId(goodsbrand1.getId());
            } else {
                goods.setGoodsBrandId(goodsbrands.get(0).getId());
            }
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(5));
            //维护freeparam字段
            List list1 = new ArrayList();
            Map map1 = new HashMap();
            map1.put("paramName", "");
            map1.put("paramValue", "");
            map1.put("paramType", "String");
            list1.add(map1);
            String freeparam = JsonUtils.obj2string(list1);
            goods.setFreeparam(freeparam);
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "-1.jpg");
            accessory.setPath("uploadfile/store/32784/2023/03/15");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(37843L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(7));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "-1.jpg");
                accessory1.setPath("uploadfile/store/32784/2023/03/15");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(37843L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 1; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "-" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2023/03/15");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(37843L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }

            //导入三峡店铺
            Goods oldgoods = new Goods().selectById(goods.getId());
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(oldgoods, newGoods);
            newGoods.setDachiGoods(oldgoods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32896L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.insert();

            System.out.println("newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(goods.getId()));
            down1.setMsg("shanxinonghang");
            down1.setGid(String.valueOf(newGoods.getId()));
            down1.insert();


            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(7));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "-1.jpg");
                accessory3.setPath("uploadfile/store/32784/2023/03/15");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(37843L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "-" + j + ".jpg");
                    accessory4.setPath("uploadfile/store/32784/2023/03/15");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(37843L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }
        }
    }

    @PostMapping("/todachi")
    @ApiOperation(value = "添加商品到大池")
    public void dachi() throws Exception {
        String filepath = "D:\\大池导入模版.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 11);
        for (int i = 0; i < dataList.size(); i++) {
            System.out.println("num:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(3));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(0);
            goods.setGoodsName(dataList.get(i).get(3));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setBarCode(dataList.get(i).get(6));
            goods.setCode(dataList.get(i).get(2));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(1);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setIsShow(1);
            goods.setJdUrl(dataList.get(i).get(10));
//            goods.setFinancialCode(dataList.get(i).get(11));
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(8));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20250621/" + dataList.get(i).get(0) + "_" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                    .eq(Goodsbrand::getName, dataList.get(i).get(9)).eq(Goodsbrand::getUserId, 32811));
            if (goodsbrands.size() < 1) {
                Goodsbrand goodsbrand1 = new Goodsbrand();
                goodsbrand1.setAddTime(new Date());
                goodsbrand1.setDeleteStatus(false);
                goodsbrand1.setAudit(true);
                goodsbrand1.setName(dataList.get(i).get(9));
                goodsbrand1.setRecommend(false);
                goodsbrand1.setSequence(1);
                goodsbrand1.setUserId(32811L);
                goodsbrand1.insert();
                goods.setGoodsBrandId(goodsbrand1.getId());
            } else {
                goods.setGoodsBrandId(goodsbrands.get(0).getId());
            }
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(5));
            //维护freeparam字段
            List list1 = new ArrayList();
            Map map1 = new HashMap();
            map1.put("paramName", "");
            map1.put("paramValue", "");
            map1.put("paramType", "String");
            list1.add(map1);
            String freeparam = JsonUtils.obj2string(list1);
            goods.setFreeparam(freeparam);
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "_1.jpg");
            accessory.setPath("uploadfile/store/32784/2025/06/21");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(7));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory1.setPath("uploadfile/store/32784/2025/06/21");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 1; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "_" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2025/06/21");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }
            System.out.println("newid:" + goods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(goods.getId()));
            down1.setMsg("dachi");
            down1.insert();
        }
    }

    @PostMapping("/todachineimenggu")
    @Transactional
    @ApiOperation(value = "添加商品到大池（内蒙古版本）")
    public void todachineimenggu() throws Exception {
        String filepath = "D:\\1-13内蒙导入-2040.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 13);
        for (int i = 0; i < dataList.size(); i++) {
            System.out.println("num:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(3));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(0);
            goods.setGoodsName(dataList.get(i).get(3));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setBarCode(dataList.get(i).get(6));
            goods.setCode(dataList.get(i).get(2));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setJdUrl(dataList.get(i).get(10));
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            goods.setGuowangSpuId(dataList.get(i).get(11));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(8));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20230531/" + dataList.get(i).get(0) + "_" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            goods.setGuowangZizhiImg("https://btob.guangbo.net/uploadfile/all/image/20230531/" + dataList.get(i).get(11) + ".jpg");
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                    .eq(Goodsbrand::getName, dataList.get(i).get(9)).eq(Goodsbrand::getUserId, 32811));
            if (goodsbrands.size() < 1) {
                Goodsbrand goodsbrand1 = new Goodsbrand();
                goodsbrand1.setAddTime(new Date());
                goodsbrand1.setDeleteStatus(false);
                goodsbrand1.setAudit(true);
                goodsbrand1.setName(dataList.get(i).get(9));
                goodsbrand1.setRecommend(false);
                goodsbrand1.setSequence(1);
                goodsbrand1.setUserId(32811L);
                goodsbrand1.insert();
                goods.setGoodsBrandId(goodsbrand1.getId());
            } else {
                goods.setGoodsBrandId(goodsbrands.get(0).getId());
            }
            goods.setGoodsStoreId(32784L);
            goods.setJdUrl(dataList.get(i).get(10));
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(5));
            //维护freeparam字段
            List list1 = new ArrayList();
            Map map1 = new HashMap();
            map1.put("paramName", "");
            map1.put("paramValue", "");
            map1.put("paramType", "String");
            list1.add(map1);
            String freeparam = JsonUtils.obj2string(list1);
            goods.setFreeparam(freeparam);
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "_1.jpg");
            accessory.setPath("uploadfile/store/32784/2023/05/31");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(7));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory1.setPath("uploadfile/store/32784/2023/05/31");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 1; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "_" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2023/05/31");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }
            System.out.println("newid:" + goods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(goods.getId()));
            down1.setMsg("dachi(neimenggu)");
            down1.insert();
        }
    }

    @PostMapping("/todachineimengguxiugai")
    @Transactional
    @ApiOperation(value = "添加商品到大池（内蒙古版本）修改")
    public void todachineimengguxiugai() throws Exception {
        String filepath = "D:\\内蒙古资质拒绝重推第二批.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 3);
        for (int i = 0; i < dataList.size(); i++) {
            //先生成商品
            Goods good = new Goods().selectById(dataList.get(i).get(0));
            new GoodsPhoto().delete(new LambdaQueryWrapper<GoodsPhoto>()
                    .eq(GoodsPhoto::getGoodsId, good.getId()));
            Goods goods = new Goods().selectById(good.getDachiGoods());
            if (goods != null) {
                new GoodsPhoto().delete(new LambdaQueryWrapper<GoodsPhoto>()
                        .eq(GoodsPhoto::getGoodsId, goods.getId()));
                String detail = "";
                Integer detailnum = Integer.valueOf(dataList.get(i).get(2));
                for (int j = 1; j <= detailnum; j++) {
                    detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20230531/" + dataList.get(i).get(0) + "_" + j + ".jpg\" alt=\"\" />";
                }
                goods.setGoodsDetails(detail);
                goods.setGuowangZizhiImg("https://btob.guangbo.net/uploadfile/all/image/20230530/" + dataList.get(i).get(0) + "_1.jpg");
                goods.insertOrUpdate();
                System.out.println("goodsid:" + goods.getId());
                //新增主图图片
                Accessory accessory = new Accessory();
                accessory.setAddTime(new Date());
                accessory.setDeleteStatus(false);
                accessory.setExt("jpg");
                accessory.setSize(Float.valueOf(0));
                accessory.setHeight(800);
                accessory.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory.setPath("uploadfile/store/32784/2023/05/31");
                accessory.setWidth(800);
                accessory.setAlbumId(39L);
                accessory.setUserId(32811L);
                accessory.insert();
                //更新商品中的主图
                goods.setGoodsMainPhotoId(accessory.getId());
                goods.insertOrUpdate();

                Integer mainnum = Integer.valueOf(dataList.get(i).get(1));
                if (mainnum == 1) {
                    Accessory accessory1 = new Accessory();
                    accessory1.setAddTime(new Date());
                    accessory1.setDeleteStatus(false);
                    accessory1.setSize(Float.valueOf(0));
                    accessory1.setExt("jpg");
                    accessory1.setHeight(800);
                    accessory1.setName(dataList.get(i).get(0) + "_1.jpg");
                    accessory1.setPath("uploadfile/store/32784/2023/05/31");
                    accessory1.setWidth(800);
                    accessory1.setAlbumId(39L);
                    accessory1.setUserId(32811L);
                    accessory1.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory1.getId());
                    goodsPhoto1.insert();
                } else {
                    for (int k = 1; k <= mainnum; k++) {
                        Accessory accessory2 = new Accessory();
                        accessory2.setAddTime(new Date());
                        accessory2.setDeleteStatus(false);
                        accessory2.setSize(Float.valueOf(0));
                        accessory2.setExt("jpg");
                        accessory2.setHeight(800);
                        accessory2.setName(dataList.get(i).get(0) + "_" + k + ".jpg");
                        accessory2.setPath("uploadfile/store/32784/2023/05/31");
                        accessory2.setWidth(800);
                        accessory2.setAlbumId(39L);
                        accessory2.setUserId(32811L);
                        accessory2.insert();
                        //创建图片商品中间表
                        GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                        goodsPhoto1.setGoodsId(goods.getId());
                        goodsPhoto1.setPhotoId(accessory2.getId());
                        goodsPhoto1.insert();
                    }
                }
            }
            String detail1 = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(2));
            for (int j = 1; j <= detailnum; j++) {
                detail1 = detail1 + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20230531/" + dataList.get(i).get(0) + "_" + j + ".jpg\" alt=\"\" />";
            }
            good.setGoodsDetails(detail1);
            good.setGuowangZizhiImg("https://btob.guangbo.net/uploadfile/all/image/20230530/" + dataList.get(i).get(0) + ".jpg");
            good.insertOrUpdate();
            System.out.println("goodsid:" + good.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "_1.jpg");
            accessory.setPath("uploadfile/store/32784/2023/05/31");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            good.setGoodsMainPhotoId(accessory.getId());
            good.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(1));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory1.setPath("uploadfile/store/32784/2023/05/31");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(good.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 1; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "_" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2023/05/31");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(good.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }
        }
    }

    @PostMapping("/todachihuadianxiugai")
//    @Transactional
    @ApiOperation(value = "添加商品到大池（华电版本）修改")
    public void todachihuadianxiugai() throws Exception {
        String filepath = "D:\\insert(2)(1).xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 4);
        for (int i = 0; i < dataList.size(); i++) {
            //先生成商品
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            new GoodsPhoto().delete(new LambdaQueryWrapper<GoodsPhoto>()
                    .eq(GoodsPhoto::getGoodsId, goods.getId()));
            if (goods != null) {
                new GoodsPhoto().delete(new LambdaQueryWrapper<GoodsPhoto>()
                        .eq(GoodsPhoto::getGoodsId, goods.getId()));
                String detail = "";
                Integer detailnum = Integer.valueOf(dataList.get(i).get(3));
                for (int j = 1; j <= detailnum; j++) {
                    detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20231010/" + dataList.get(i).get(1) + "_" + j + ".jpg\" alt=\"\" />";
                }
                goods.setGoodsDetails(detail);
                goods.insertOrUpdate();
                System.out.println("goodsid:" + goods.getId());
                //新增主图图片
                Accessory accessory = new Accessory();
                accessory.setAddTime(new Date());
                accessory.setDeleteStatus(false);
                accessory.setExt("jpg");
                accessory.setSize(Float.valueOf(0));
                accessory.setHeight(800);
                accessory.setName(dataList.get(i).get(1) + "_1.jpg");
                accessory.setPath("uploadfile/store/32784/2023/10/10");
                accessory.setWidth(800);
                accessory.setAlbumId(39L);
                accessory.setUserId(32811L);
                accessory.insert();
                //更新商品中的主图
                goods.setGoodsMainPhotoId(accessory.getId());
                goods.insertOrUpdate();

                Integer mainnum = Integer.valueOf(dataList.get(i).get(2));
                if (mainnum == 1) {
                    Accessory accessory1 = new Accessory();
                    accessory1.setAddTime(new Date());
                    accessory1.setDeleteStatus(false);
                    accessory1.setSize(Float.valueOf(0));
                    accessory1.setExt("jpg");
                    accessory1.setHeight(800);
                    accessory1.setName(dataList.get(i).get(1) + "_1.jpg");
                    accessory1.setPath("uploadfile/store/32784/2023/10/10");
                    accessory1.setWidth(800);
                    accessory1.setAlbumId(39L);
                    accessory1.setUserId(32811L);
                    accessory1.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory1.getId());
                    goodsPhoto1.insert();
                } else {
                    for (int k = 1; k <= mainnum; k++) {
                        Accessory accessory2 = new Accessory();
                        accessory2.setAddTime(new Date());
                        accessory2.setDeleteStatus(false);
                        accessory2.setSize(Float.valueOf(0));
                        accessory2.setExt("jpg");
                        accessory2.setHeight(800);
                        accessory2.setName(dataList.get(i).get(1) + "_" + k + ".jpg");
                        accessory2.setPath("uploadfile/store/32784/2023/10/10");
                        accessory2.setWidth(800);
                        accessory2.setAlbumId(39L);
                        accessory2.setUserId(32811L);
                        accessory2.insert();
                        //创建图片商品中间表
                        GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                        goodsPhoto1.setGoodsId(goods.getId());
                        goodsPhoto1.setPhotoId(accessory2.getId());
                        goodsPhoto1.insert();
                    }
                }
            }
        }
    }

    @PostMapping("/todachinengjianxiugai")
    @Transactional
    @ApiOperation(value = "添加商品到大池（能建版本）修改")
    public void todachinengjianxiugai() throws Exception {
        String filepath = "D:\\能建第二批京东图片对应.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 4);
        for (int i = 0; i < dataList.size(); i++) {
            //先生成商品
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            new GoodsPhoto().delete(new LambdaQueryWrapper<GoodsPhoto>()
                    .eq(GoodsPhoto::getGoodsId, goods.getId()));
            if (goods != null) {
                new GoodsPhoto().delete(new LambdaQueryWrapper<GoodsPhoto>()
                        .eq(GoodsPhoto::getGoodsId, goods.getId()));
                String detail = "";
                Integer detailnum = Integer.valueOf(dataList.get(i).get(3));
                for (int j = 1; j <= detailnum; j++) {
                    detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20230802/" + dataList.get(i).get(1) + "_" + j + ".jpg\" alt=\"\" />";
                }
                goods.setGoodsDetails(detail);
                goods.insertOrUpdate();
                System.out.println("goodsid:" + goods.getId());
                //新增主图图片
                Accessory accessory = new Accessory();
                accessory.setAddTime(new Date());
                accessory.setDeleteStatus(false);
                accessory.setExt("jpg");
                accessory.setSize(Float.valueOf(0));
                accessory.setHeight(800);
                accessory.setName(dataList.get(i).get(1) + "_1.jpg");
                accessory.setPath("uploadfile/store/32784/2023/08/02");
                accessory.setWidth(800);
                accessory.setAlbumId(39L);
                accessory.setUserId(32811L);
                accessory.insert();
                //更新商品中的主图
                goods.setGoodsMainPhotoId(accessory.getId());
                goods.insertOrUpdate();

                Integer mainnum = Integer.valueOf(dataList.get(i).get(2));
                if (mainnum == 1) {
                    Accessory accessory1 = new Accessory();
                    accessory1.setAddTime(new Date());
                    accessory1.setDeleteStatus(false);
                    accessory1.setSize(Float.valueOf(0));
                    accessory1.setExt("jpg");
                    accessory1.setHeight(800);
                    accessory1.setName(dataList.get(i).get(1) + "_1.jpg");
                    accessory1.setPath("uploadfile/store/32784/2023/08/02");
                    accessory1.setWidth(800);
                    accessory1.setAlbumId(39L);
                    accessory1.setUserId(32811L);
                    accessory1.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory1.getId());
                    goodsPhoto1.insert();
                } else {
                    for (int k = 1; k <= mainnum; k++) {
                        Accessory accessory2 = new Accessory();
                        accessory2.setAddTime(new Date());
                        accessory2.setDeleteStatus(false);
                        accessory2.setSize(Float.valueOf(0));
                        accessory2.setExt("jpg");
                        accessory2.setHeight(800);
                        accessory2.setName(dataList.get(i).get(1) + "_" + k + ".jpg");
                        accessory2.setPath("uploadfile/store/32784/2023/08/02");
                        accessory2.setWidth(800);
                        accessory2.setAlbumId(39L);
                        accessory2.setUserId(32811L);
                        accessory2.insert();
                        //创建图片商品中间表
                        GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                        goodsPhoto1.setGoodsId(goods.getId());
                        goodsPhoto1.setPhotoId(accessory2.getId());
                        goodsPhoto1.insert();
                    }
                }
            }
        }
    }

    @PostMapping("/gaizizhi")
    @Transactional
    @ApiOperation(value = "添加商品到大池（内蒙古版本）")
    public void gaizizhi() throws Exception {
        String filepath = "D:\\工作簿2.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            goods.setGuowangZizhiImg("https://btob.guangbo.net/uploadfile/all/image/20230531/" + dataList.get(i).get(1) + ".jpg");
            goods.insertOrUpdate();
            System.out.println(goods.getId());
        }
    }

    @PostMapping("/dachitoshanxiyh")
    @ApiOperation(value = "添加商品到大池再到山西银行")
    public void dachitoshanxiyh() throws Exception {
        String filepath = "D:\\大池导入模版 - 副本(2)(1).xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 11);
        for (int i = 1; i < dataList.size(); i++) {
            System.out.println("num:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(3));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(0);
            goods.setGoodsName(dataList.get(i).get(3));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setBarCode(dataList.get(i).get(6));
            goods.setCode(dataList.get(i).get(2));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setJdUrl(dataList.get(i).get(10));
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(8));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20230424/" + dataList.get(i).get(0) + "_" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                    .eq(Goodsbrand::getName, dataList.get(i).get(9)).eq(Goodsbrand::getUserId, 32811));
            if (goodsbrands.size() < 1) {
                Goodsbrand goodsbrand1 = new Goodsbrand();
                goodsbrand1.setAddTime(new Date());
                goodsbrand1.setDeleteStatus(false);
                goodsbrand1.setAudit(true);
                goodsbrand1.setName(dataList.get(i).get(9));
                goodsbrand1.setRecommend(false);
                goodsbrand1.setSequence(1);
                goodsbrand1.setUserId(32811L);
                goodsbrand1.insert();
                goods.setGoodsBrandId(goodsbrand1.getId());
            } else {
                goods.setGoodsBrandId(goodsbrands.get(0).getId());
            }
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(5));
            //维护freeparam字段
            List list1 = new ArrayList();
            Map map1 = new HashMap();
            map1.put("paramName", "");
            map1.put("paramValue", "");
            map1.put("paramType", "String");
            list1.add(map1);
            String freeparam = JsonUtils.obj2string(list1);
            goods.setFreeparam(freeparam);
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "_1.jpg");
            accessory.setPath("uploadfile/store/32784/2023/04/24");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(7));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory1.setPath("uploadfile/store/32784/2023/04/24");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 1; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "_" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2023/04/24");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }
            //添加国网商品从大池到店铺
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(goods, newGoods);
            newGoods.setDachiGoods(goods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32896L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(1);
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(newGoods.getId()));
            down1.setMsg(String.valueOf(newGoods.getDachiGoods()));
            down1.insert();

            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(7));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory3.setPath("uploadfile/store/32784/2023/04/24");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(32811L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "_" + j + ".jpg");
                    accessory4.setPath("uploadfile/store/32784/2023/04/24");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(32811L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }
        }
    }

    @PostMapping("/nanwangxiang")
    @ApiOperation(value = "添加南网商品到大池 再到店铺")
    public void nanwangxiang() throws Exception {
        String filepath = "D:\\第三批.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 1);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            Zizhi zizhi = new Zizhi();
            zizhi.setId(String.valueOf(goods.getId()));
            zizhi.setMsg(String.valueOf(goods.getDachiGoods()));
            zizhi.setPin("dachi");
            zizhi.insert();
            System.out.println(i);
        }
    }

    @PostMapping("/nanwang")
    @ApiOperation(value = "添加南网商品到大池 再到店铺")
    public void nanwang() throws Exception {
        String filepath = "D:\\南网商品上架（和讯）-广博格式.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 20);
        for (int i = 0; i < dataList.size(); i++) {
            System.out.println("num:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(6));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(6));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(7)));
            goods.setGoodsRecommend(true);
            goods.setBarCode(dataList.get(i).get(18));
            goods.setJdUrl(dataList.get(i).get(17));
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(7)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20231012/" + dataList.get(i).get(14) + ".jpg\" alt=\"\" />";
            goods.setGoodsDetails(detail);
            Goodsbrand goodsbrand = new Goodsbrand().selectById(dataList.get(i).get(2));
            if (goodsbrand == null) {
                List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                        .eq(Goodsbrand::getName, dataList.get(i).get(2)).eq(Goodsbrand::getUserId, 33012));
                if (goodsbrands.size() < 1) {
                    Goodsbrand goodsbrand1 = new Goodsbrand();
                    goodsbrand1.setAddTime(new Date());
                    goodsbrand1.setDeleteStatus(false);
                    goodsbrand1.setAudit(true);
                    goodsbrand1.setName(dataList.get(i).get(2));
                    goodsbrand1.setRecommend(false);
                    goodsbrand1.setSequence(1);
                    goodsbrand1.setUserId(33012L);
                    goodsbrand1.insert();
                    goods.setGoodsBrandId(goodsbrand1.getId());
                } else {
                    goods.setGoodsBrandId(goodsbrands.get(0).getId());
                }
            } else {
                goods.setGoodsBrandId(Long.valueOf(dataList.get(i).get(2)));
            }
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(7)));
            goods.setCode(dataList.get(i).get(5));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(16));
            List list123 = new ArrayList();
            Map map123 = new HashMap();
            map123.put("paramName", "modelName");
            map123.put("paramValue", dataList.get(i).get(19));
            map123.put("paramType", "String");
            list123.add(map123);
            String s123 = JsonUtils.obj2string(list123);
            goods.setFreeparam(s123);
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(8) + ".jpg");
            accessory.setPath("uploadfile/store/32784/2023/10/12");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Accessory accessory2 = new Accessory();
            accessory2.setAddTime(new Date());
            accessory2.setDeleteStatus(false);
            accessory2.setSize(Float.valueOf(0));
            accessory2.setExt("jpg");
            accessory2.setHeight(800);
            accessory2.setName(dataList.get(i).get(10) + ".jpg");
            accessory2.setPath("uploadfile/store/32784/2023/10/12");
            accessory2.setWidth(800);
            accessory2.setAlbumId(39L);
            accessory2.setUserId(32811L);
            accessory2.insert();
            //创建图片商品中间表
            GoodsPhoto goodsPhoto1 = new GoodsPhoto();
            goodsPhoto1.setGoodsId(goods.getId());
            goodsPhoto1.setPhotoId(accessory2.getId());
            goodsPhoto1.insert();

            Accessory accessory3 = new Accessory();
            accessory3.setAddTime(new Date());
            accessory3.setDeleteStatus(false);
            accessory3.setSize(Float.valueOf(0));
            accessory3.setExt("jpg");
            accessory3.setHeight(800);
            accessory3.setName(dataList.get(i).get(12) + ".jpg");
            accessory3.setPath("uploadfile/store/32784/2023/10/12");
            accessory3.setWidth(800);
            accessory3.setAlbumId(39L);
            accessory3.setUserId(32811L);
            accessory3.insert();
            //创建图片商品中间表
            GoodsPhoto goodsPhoto2 = new GoodsPhoto();
            goodsPhoto2.setGoodsId(goods.getId());
            goodsPhoto2.setPhotoId(accessory3.getId());
            goodsPhoto2.insert();
            //添加国网商品从大池到店铺
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(goods, newGoods);
            newGoods.setDachiGoods(goods.getId());
            Goodsbrand goodsbrand2 = new Goodsbrand().selectById(dataList.get(i).get(4));
            if (goodsbrand2 == null) {
                Goodsbrand goodsbrand3 = new Goodsbrand();
                goodsbrand3.setAddTime(new Date());
                goodsbrand3.setDeleteStatus(false);
                goodsbrand3.setAudit(true);
                goodsbrand3.setName(dataList.get(i).get(4));
                goodsbrand3.setRecommend(false);
                goodsbrand3.setSequence(1);
                goodsbrand3.setUserId(38227L);
                goodsbrand3.insert();
                newGoods.setGoodsBrandId(goodsbrand3.getId());
            } else {
                newGoods.setGoodsBrandId(Long.valueOf(dataList.get(i).get(4)));
            }
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32790L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(newGoods.getId()));
            down1.insert();
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(3)));
            goodsUgc.insert();
            Accessory accessory4 = new Accessory();
            accessory4.setAddTime(new Date());
            accessory4.setDeleteStatus(false);
            accessory4.setSize(Float.valueOf(0));
            accessory4.setExt("jpg");
            accessory4.setHeight(800);
            accessory4.setName(dataList.get(i).get(10) + ".jpg");
            accessory4.setPath("uploadfile/store/32784/2023/10/12");
            accessory4.setWidth(800);
            accessory4.setAlbumId(39L);
            accessory4.setUserId(32811L);
            accessory4.insert();
            //创建图片商品中间表
            GoodsPhoto goodsPhoto3 = new GoodsPhoto();
            goodsPhoto3.setGoodsId(newGoods.getId());
            goodsPhoto3.setPhotoId(accessory4.getId());
            goodsPhoto3.insert();

            Accessory accessory5 = new Accessory();
            accessory5.setAddTime(new Date());
            accessory5.setDeleteStatus(false);
            accessory5.setSize(Float.valueOf(0));
            accessory5.setExt("jpg");
            accessory5.setHeight(800);
            accessory5.setName(dataList.get(i).get(12) + ".jpg");
            accessory5.setPath("uploadfile/store/32784/2023/10/12");
            accessory5.setWidth(800);
            accessory5.setAlbumId(39L);
            accessory5.setUserId(32811L);
            accessory5.insert();
            //创建图片商品中间表
            GoodsPhoto goodsPhoto4 = new GoodsPhoto();
            goodsPhoto4.setGoodsId(newGoods.getId());
            goodsPhoto4.setPhotoId(accessory5.getId());
            goodsPhoto4.insert();
        }
    }

    @PostMapping("/jianyu")
    @ApiOperation(value = "添加监狱商品到大池 再到店铺")
    public void jianyu() throws Exception {
        String filepath = "D:\\副本商品(2).xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 10);
        for (int i = 0; i < dataList.size(); i++) {
            System.out.println("num:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(5));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(10);
            goods.setGoodsName(dataList.get(i).get(5));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setCode(dataList.get(i).get(4));
            goods.setGoodsStatus(1);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            goods.setGoodsBrandId(Long.valueOf(dataList.get(i).get(2)));
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(9));
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(7) + ".jpg");
            accessory.setPath("uploadfile/store/32784/2022/07/15");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();
            //添加国网商品从大池到店铺
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(goods, newGoods);
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32881L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.setDachiGoods(goods.getId());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(newGoods.getId()));
            down1.insert();
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(3)));
            goodsUgc.insert();
        }
    }


    @PostMapping("/nanwanggaijia")
    @ApiOperation(value = "南网改价")
    public void nanwanggaijia() throws Exception {
        String filepath = "D:\\1.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            GoodsUgc goodsUgc = new GoodsUgc().selectOne(new LambdaQueryWrapper<GoodsUgc>()
                    .eq(GoodsUgc::getGoodsId, goods.getId()));
            Usergoodsclass usergoodsclass = new Usergoodsclass().selectById(goodsUgc.getClassId());
            String discount = usergoodsclass.getDiscount();
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(1)).divide(new BigDecimal(discount), BigDecimal.ROUND_HALF_UP));
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(1)));
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(1)));
            goods.insertOrUpdate();
        }
    }

    @PostMapping("/jiashuxing")
    @ApiOperation(value = "福建加属性")
    public void jiashuxing() throws Exception {
        String filepath = "D:\\票夹.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        int a = 29;
        List<Map<Integer, String>> dataList = ExcelImport.read(file, a);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            List list = new ArrayList();
            for (int j = 1; j < a - 1; j = j + 2) {
                Map map = new HashMap();
                map.put("paramName", dataList.get(i).get(j));
                map.put("paramValue", dataList.get(i).get(j + 1));
                map.put("paramType", "String");
                list.add(map);
            }

            String s = JsonUtils.obj2string(list);
            System.out.println(s);
            goods.setFreeparam(s);
            goods.insertOrUpdate();
        }
    }

    @PostMapping("/jiaxiaoxi")
    @ApiOperation(value = "福建加添加商品消息")
    public void jiaxiaoxi() throws Exception {
        String ss = "1981010,1981009,1981008,1981007,1981006,1981005,1981004,1981003";
        String[] split = ss.split(",");
        List<String> strings = Arrays.asList(split);
        for (String s : strings) {
            GcyMessage gcyMessage = new GcyMessage();
            gcyMessage.setSku(s);
            gcyMessage.setType(6);
            gcyMessage.setAddStates(1);
            gcyMessage.setUserId("186481");
            gcyMessage.setFlag(0);
            gcyMessage.insert();
            System.out.println(s);
        }
    }

    @PostMapping("/jiapinpai")
    @ApiOperation(value = "国网加品牌")
    public void jiapinpai() throws Exception {
        String filepath = "D:\\国网品牌新增.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            Goodsbrand goodsbrand = new Goodsbrand();
            goodsbrand.setAddTime(new Date());
            goodsbrand.setDeleteStatus(false);
            goodsbrand.setAudit(true);
            goodsbrand.setName(dataList.get(i).get(0));
            goodsbrand.setRecommend(false);
            goodsbrand.setSequence(1);
            goodsbrand.setUserId(38048L);
            goodsbrand.setGuowangEpoint(dataList.get(i).get(1));
            goodsbrand.insert();
        }
    }

    @PostMapping("/xhuarungaijia")
    @ApiOperation(value = "华润改价格")
    public void xhuarungaijia() throws Exception {
        String filepath = "D:\\新建 Microsoft Excel 工作表.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(1)));
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(1)));
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(1)));
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            HrMsg msg = new HrMsg();
            Date date = new Date();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String format = sdf.format(date);
            msg.setTime(format);
            msg.setType(2);
            msg.setStatus(1);
            msg.setStoreId(32872);
            Map map1 = new HashMap();
            map1.put("skuId", goods.getId() + "");
            msg.setResult(JSON.toJSONString(map1));
            msg.insert();
        }
    }


    @PostMapping("/jishi")
    @ApiOperation(value = "修改国网图片")
    public void jishi() throws Exception {
        String filepath = "D:\\图片驳回重新抓图.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        //1、图片编号 2、sku 3、主图张数 4、详情图张数
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 4);
        for (int i = 0; i < dataList.size(); i++) {
            System.out.println(i);
            Goods goods = new Goods().selectById(dataList.get(i).get(1));
            Goods dcGoods = new Goods().selectById(goods.getDachiGoods());
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(3));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20211028/" + dataList.get(i).get(0) + "_" + j + ".jpg\" alt=\"\" />";
            }
            //更新详情图
            goods.setGoodsDetails(detail);
            dcGoods.setGoodsDetails(detail);
            goods.insertOrUpdate();
            dcGoods.insertOrUpdate();
            //更新主图
            new GoodsPhoto().delete(new LambdaQueryWrapper<GoodsPhoto>().eq(GoodsPhoto::getGoodsId, goods.getId()));
            new GoodsPhoto().delete(new LambdaQueryWrapper<GoodsPhoto>().eq(GoodsPhoto::getGoodsId, dcGoods.getId()));
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "_1.jpg");
            accessory.setPath("uploadfile/store/32784/2021/10/28");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            dcGoods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();
            dcGoods.insertOrUpdate();
            Integer mainnum = Integer.valueOf(dataList.get(i).get(2));
            for (int k = 2; k <= mainnum; k++) {
                Accessory accessory2 = new Accessory();
                accessory2.setAddTime(new Date());
                accessory2.setDeleteStatus(false);
                accessory2.setSize(Float.valueOf(0));
                accessory2.setExt("jpg");
                accessory2.setHeight(800);
                accessory2.setName(dataList.get(i).get(0) + "_" + k + ".jpg");
                accessory2.setPath("uploadfile/store/32784/2021/10/28");
                accessory2.setWidth(800);
                accessory2.setAlbumId(39L);
                accessory2.setUserId(32811L);
                accessory2.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory2.getId());
                goodsPhoto1.insert();

                GoodsPhoto goodsPhoto2 = new GoodsPhoto();
                goodsPhoto2.setGoodsId(dcGoods.getId());
                goodsPhoto2.setPhotoId(accessory2.getId());
                goodsPhoto2.insert();
            }
        }
    }


    @PostMapping("/gwtosg")
    @Transactional
    @ApiOperation(value = "复制国网的商品到国外省管")
    public void gwtosg() throws Exception {
        String filepath = "D:\\2023-8-28省管店铺新增.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 9);
        for (int i = 0; i < dataList.size(); i++) {
            Goods gwGoods = new Goods().selectById(dataList.get(i).get(0));
            if (gwGoods == null) {
                continue;
            }
            Goods sgGoods = new Goods();
            BeanUtils.copyProperties(gwGoods, sgGoods);
            sgGoods.setAddTime(new Date());
            sgGoods.setGoodsName(dataList.get(i).get(5));
            sgGoods.setCode(dataList.get(i).get(4));
            sgGoods.setGwTaxSortCode(dataList.get(i).get(8));
            sgGoods.setGoodsStoreId(32832L);
            sgGoods.insert();
            System.out.println("gwGoods:" + gwGoods.getId() + ",sgGoods:" + sgGoods.getId());
            List<GoodsPhoto> goodsPhotos = new GoodsPhoto().selectList(new LambdaQueryWrapper<GoodsPhoto>()
                    .eq(GoodsPhoto::getGoodsId, gwGoods.getId()));
            for (GoodsPhoto goodsPhoto : goodsPhotos) {
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(sgGoods.getId());
                goodsPhoto1.setPhotoId(goodsPhoto.getPhotoId());
                goodsPhoto1.insert();
            }
            //检查品牌并维护
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>().eq(Goodsbrand::getUserId, 38255)
                    .eq(Goodsbrand::getName, dataList.get(i).get(3)));
            Goodsbrand goodsbrand = new Goodsbrand();
            if (goodsbrands.size() < 1) {
                goodsbrand.setAddTime(new Date());
                goodsbrand.setDeleteStatus(false);
                goodsbrand.setAudit(false);
                goodsbrand.setName(dataList.get(i).get(3));
                goodsbrand.setRecommend(true);
                goodsbrand.setSequence(1);
                goodsbrand.setUserId(38255L);
                goodsbrand.setGuowangEpoint(dataList.get(i).get(7));
                goodsbrand.insert();
            } else {
                goodsbrands.get(0).setGuowangEpoint(dataList.get(i).get(7));
                goodsbrand = goodsbrands.get(0);
            }
            sgGoods.setGoodsBrandId(goodsbrand.getId());
            sgGoods.insertOrUpdate();
            //检查分类
            String val = dataList.get(i).get(2);
            Usergoodsclass usergoodsclass = new Usergoodsclass().selectOne(new LambdaQueryWrapper<Usergoodsclass>()
                    .eq(Usergoodsclass::getGuowangBianma, val)
                    .eq(Usergoodsclass::getUserId, 38255));
//            if (usergoodsclass != null) {
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(sgGoods.getId());
            goodsUgc.setClassId(usergoodsclass.getId());
            goodsUgc.insert();
            down down = new down();
            down.setId(String.valueOf(gwGoods.getId()));
            down.setGid(String.valueOf(sgGoods.getId()));
            down.insert();
//            } else {
//                GoodsUgc goodsUgc = new GoodsUgc().selectOne(new LambdaQueryWrapper<GoodsUgc>().eq(GoodsUgc::getGoodsId, gwGoods.getId()));
//                Usergoodsclass gwclass = new Usergoodsclass().selectById(goodsUgc.getClassId());
//                Usergoodsclass sgclass = new Usergoodsclass();
//                sgclass = new Usergoodsclass().selectOne(new LambdaQueryWrapper<Usergoodsclass>()
//                        .eq(Usergoodsclass::getClassName, gwclass.getClassName())
//                        .eq(Usergoodsclass::getUserId, 38255));
//                if (sgclass == null) {
//                    sgclass = new Usergoodsclass().selectOne(new LambdaQueryWrapper<Usergoodsclass>()
//                            .eq(Usergoodsclass::getClassName, gwclass.getGuowangWuliaoName())
//                            .eq(Usergoodsclass::getUserId, 38255));
//                }
//                sgclass.setClassName(dataList.get(i).get(1));
//                sgclass.setGuowangBianma(dataList.get(i).get(2));
//                sgclass.setEpointid(dataList.get(i).get(6));
//                sgclass.insertOrUpdate();
//                GoodsUgc goodsUgc1 = new GoodsUgc();
//                goodsUgc1.setGoodsId(sgGoods.getId());
//                goodsUgc1.setClassId(sgclass.getId());
//                goodsUgc1.insert();
//                down down = new down();
//                down.setId(String.valueOf(gwGoods.getId()));
//                down.setGid(String.valueOf(sgGoods.getId()));
//                down.insert();
//            }

        }
    }

    @PostMapping("/zjtogq")
    @Transactional
    @ApiOperation(value = "复制浙江监狱的商品到高桥监狱")
    public void zjtogq() throws Exception {
        List<Goods> goods = new Goods().selectList(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsStoreId, 32881)
                .eq(Goods::getGoodsStatus, 0));
        for (int i = 0; i < goods.size(); i++) {
            Goods zjGoods = new Goods().selectById(goods.get(i));
            Goods gqGoods = new Goods();
            BeanUtils.copyProperties(zjGoods, gqGoods);
            gqGoods.setAddTime(new Date());
            gqGoods.setGoodsguid("");
            gqGoods.setGoodsStoreId(32886L);
            gqGoods.insert();
            System.out.println("zjGoods:" + zjGoods.getId() + ",gqGoods:" + gqGoods.getId());
            //检查分类
            GoodsUgc zjgoodsUgc = new GoodsUgc().selectOne(new LambdaQueryWrapper<GoodsUgc>()
                    .eq(GoodsUgc::getGoodsId, zjGoods.getId()));
            Usergoodsclass zjusergoodsclass = new Usergoodsclass().selectById(zjgoodsUgc.getClassId());
            Usergoodsclass usergoodsclass = new Usergoodsclass().selectOne(new LambdaQueryWrapper<Usergoodsclass>()
                    .eq(Usergoodsclass::getUserId, 186730)
                    .eq(Usergoodsclass::getClassName, zjusergoodsclass.getClassName()));
            if (usergoodsclass != null) {
                GoodsUgc goodsUgc = new GoodsUgc();
                goodsUgc.setGoodsId(gqGoods.getId());
                goodsUgc.setClassId(usergoodsclass.getId());
                goodsUgc.insert();
                down down = new down();
                down.setId(String.valueOf(zjGoods.getId()));
                down.setMsg("浙江监狱复制到高桥监狱");
                down.setGid(String.valueOf(gqGoods.getId()));
                down.insert();
            } else {
                new Goods().deleteById(gqGoods.getId());
            }

        }
    }

    @PostMapping("/gwtodc")
    @ApiOperation(value = "复制国网的商品到大池")
    public void gwtodc() throws Exception {
        String filepath = "D:\\国网-大池SKU(1).xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            Goods gwGoods = new Goods().selectById(dataList.get(i).get(0));
            Goods goods = new Goods().selectById(gwGoods.getDachiGoods());
            if (goods == null) {
                Goods dcGoods = new Goods();
                BeanUtils.copyProperties(gwGoods, dcGoods);
                dcGoods.setAddTime(new Date());
                dcGoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(1)));
                dcGoods.setStorePrice(new BigDecimal(dataList.get(i).get(1)));
                dcGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(1)));
                dcGoods.setGoodsStoreId(32784L);
                dcGoods.insert();
                //维护InventoryDetail字段
                List list = new ArrayList();
                Map map = new HashMap();
                map.put("id", "32768_");
                map.put("safeinventory", dcGoods.getGoodsSafeInventory().toString());
                map.put("price", dcGoods.getStorePrice().toString());
                map.put("count", dcGoods.getGoodsInventory().toString());
                map.put("barcode", dcGoods.getBarCode() == null ? 0 : dcGoods.getBarCode());
                map.put("goodsserial", "");
                map.put("colgoodscode", dcGoods.getCode() + "01");
                map.put("promprice", 0);
                map.put("erpid", "");
                list.add(map);
                String s = JsonUtils.obj2string(list);
                dcGoods.setGoodsInventoryDetail(s);
                dcGoods.insertOrUpdate();
                gwGoods.setDachiGoods(dcGoods.getId());
                gwGoods.insertOrUpdate();
                System.out.println("gwGoods:" + gwGoods.getId() + ",dcGoods:" + dcGoods.getId());
                down down = new down();
                down.setId(String.valueOf(gwGoods.getId()));
                down.setGid(String.valueOf(dcGoods.getId()));
                down.setMsg("gwtodc");
                down.insert();
            } else {
                goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(1)));
                goods.setStorePrice(new BigDecimal(dataList.get(i).get(1)));
                goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(1)));
                goods.insertOrUpdate();
                //维护InventoryDetail字段
                List list = new ArrayList();
                Map map = new HashMap();
                map.put("id", "32768_");
                map.put("safeinventory", goods.getGoodsSafeInventory().toString());
                map.put("price", goods.getStorePrice().toString());
                map.put("count", goods.getGoodsInventory().toString());
                map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
                map.put("goodsserial", "");
                map.put("colgoodscode", goods.getCode() + "01");
                map.put("promprice", 0);
                map.put("erpid", "");
                list.add(map);
                String s = JsonUtils.obj2string(list);
                goods.setGoodsInventoryDetail(s);
                goods.insertOrUpdate();
                System.out.println("gwGoods:" + gwGoods.getId() + ",dcGoods:" + goods.getId());
                down down = new down();
                down.setId(String.valueOf(gwGoods.getId()));
                down.setGid(String.valueOf(goods.getId()));
                down.setMsg("gwtodc");
                down.insert();
            }

        }
    }

    @PostMapping("/gwtohx")
    @ApiOperation(value = "复制国网的商品到华夏")
    public void gwtohx() throws Exception {
        String filepath = "D:\\国网-华夏(1)(1).xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 3);
        for (int i = 0; i < dataList.size(); i++) {
            Goods gwGoods = new Goods().selectById(dataList.get(i).get(0));
            Goods hxGoods = new Goods();
            BeanUtils.copyProperties(gwGoods, hxGoods);
            hxGoods.setAddTime(new Date());
            hxGoods.setGoodsName(dataList.get(i).get(1));
            hxGoods.setGoodsStoreId(32839L);
            hxGoods.insert();
            System.out.println("gwGoods:" + gwGoods.getId() + ",sgGoods:" + hxGoods.getId());
            GoodsUgc goodsUgc1 = new GoodsUgc();
            goodsUgc1.setGoodsId(hxGoods.getId());
            goodsUgc1.setClassId(Long.valueOf(dataList.get(i).get(2)));
            goodsUgc1.insert();
            down down = new down();
            down.setId(String.valueOf(hxGoods.getId()));
            down.setMsg("huaxia");
            down.insert();
        }
    }

    @PostMapping("/gwtonmg")
    @ApiOperation(value = "复制国网的商品到内蒙古")
    public void gwtonmg() throws Exception {
        String filepath = "D:\\内蒙古(2)(1).xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 4);
        for (int i = 1; i < dataList.size(); i++) {
            Goods gwGoods = new Goods().selectById(dataList.get(i).get(0));
            Goods dachiGoods = new Goods().selectById(gwGoods.getDachiGoods());
            dachiGoods.setStorePrice(new BigDecimal(dataList.get(i).get(1)));
            dachiGoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(1)));
            dachiGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(1)));
            dachiGoods.insertOrUpdate();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", dachiGoods.getGoodsSafeInventory().toString());
            map.put("price", dachiGoods.getStorePrice().toString());
            map.put("count", dachiGoods.getGoodsInventory().toString());
            map.put("barcode", dachiGoods.getBarCode() == null ? 0 : dachiGoods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", dachiGoods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            dachiGoods.setGoodsInventoryDetail(s);
            dachiGoods.insertOrUpdate();

            Goods hxGoods = new Goods();
            BeanUtils.copyProperties(gwGoods, hxGoods);
            hxGoods.setAddTime(new Date());
            hxGoods.setGoodsStoreId(32835L);
            hxGoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(1)));
            hxGoods.setStorePrice(new BigDecimal(dataList.get(i).get(2)));
            hxGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(2)));
            //维护InventoryDetail字段
            List list1 = new ArrayList();
            Map map1 = new HashMap();
            map1.put("id", "32768_");
            map1.put("safeinventory", dachiGoods.getGoodsSafeInventory().toString());
            map1.put("price", dachiGoods.getStorePrice().toString());
            map1.put("count", dachiGoods.getGoodsInventory().toString());
            map1.put("barcode", dachiGoods.getBarCode() == null ? 0 : dachiGoods.getBarCode());
            map1.put("goodsserial", "");
            map1.put("colgoodscode", dachiGoods.getCode() + "01");
            map1.put("promprice", 0);
            map1.put("erpid", "");
            list1.add(map1);
            String s1 = JsonUtils.obj2string(list1);
            hxGoods.setGoodsInventoryDetail(s1);
            hxGoods.insert();
            System.out.println("gwGoods:" + gwGoods.getId() + ",nmgGoods:" + hxGoods.getId());
            GoodsUgc goodsUgc1 = new GoodsUgc();
            goodsUgc1.setGoodsId(hxGoods.getId());
            goodsUgc1.setClassId(Long.valueOf(dataList.get(i).get(3)));
            goodsUgc1.insert();
        }
    }

    @PostMapping("/gwtoks")
    @ApiOperation(value = "复制国网的商品到昆山")
    public void gwtoks() throws Exception {
        String filepath = "D:\\2022-5-11国网商品上架昆山(1).xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 5);
        for (int i = 1; i < dataList.size(); i++) {
            Goods gwGoods = new Goods().selectById(dataList.get(i).get(0));
            Goods ksGoods = new Goods();
            BeanUtils.copyProperties(gwGoods, ksGoods);
            ksGoods.setAddTime(new Date());
            ksGoods.setGoodsStoreId(32866L);
            ksGoods.setGoodsPrice(new BigDecimal(dataList.get(i).get(1)));
            ksGoods.setStorePrice(new BigDecimal(dataList.get(i).get(2)));
            ksGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(2)));
            //检查品牌并维护
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>().eq(Goodsbrand::getUserId, 100571)
                    .eq(Goodsbrand::getName, dataList.get(i).get(4)));
            Goodsbrand goodsbrand = new Goodsbrand();
            if (goodsbrands.size() < 1) {
                goodsbrand.setAddTime(new Date());
                goodsbrand.setDeleteStatus(false);
                goodsbrand.setAudit(false);
                goodsbrand.setName(dataList.get(i).get(4));
                goodsbrand.setRecommend(true);
                goodsbrand.setSequence(1);
                goodsbrand.setUserId(32866L);
                goodsbrand.insert();
            } else {
                goodsbrand = goodsbrands.get(0);
            }
            ksGoods.setGoodsBrandId(goodsbrand.getId());
            ksGoods.insert();
            //维护InventoryDetail字段
            List list1 = new ArrayList();
            Map map1 = new HashMap();
            map1.put("id", "32768_");
            map1.put("safeinventory", ksGoods.getGoodsSafeInventory().toString());
            map1.put("price", ksGoods.getStorePrice().toString());
            map1.put("count", ksGoods.getGoodsInventory().toString());
            map1.put("barcode", ksGoods.getBarCode() == null ? 0 : ksGoods.getBarCode());
            map1.put("goodsserial", "");
            map1.put("colgoodscode", ksGoods.getCode() + "01");
            map1.put("promprice", 0);
            map1.put("erpid", "");
            list1.add(map1);
            String s1 = JsonUtils.obj2string(list1);
            ksGoods.setGoodsInventoryDetail(s1);
            ksGoods.insertOrUpdate();
            System.out.println("gwGoods:" + gwGoods.getId() + ",ksGoods:" + ksGoods.getId());
            GoodsUgc goodsUgc1 = new GoodsUgc();
            goodsUgc1.setGoodsId(ksGoods.getId());
            goodsUgc1.setClassId(Long.valueOf(dataList.get(i).get(3)));
            goodsUgc1.insert();
        }
    }

    @PostMapping("/huarungaijia")
    @ApiOperation(value = "华润修改大池价格")
    public void huarungaijia() throws Exception {
        String filepath = "D:\\大池调高价格.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(1)));
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(1)));
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(1)));
            goods.insertOrUpdate();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println(i);
        }
    }

    @PostMapping("/huarunqidingliang")
    @ApiOperation(value = "华润修改起订量")
    public void huarunqidingliang() throws Exception {
        String filepath = "D:\\华润起订量.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            goods.setGoodsMinbuynum(Integer.valueOf(dataList.get(i).get(1)));
            goods.insertOrUpdate();
            //商品变更消息推送
            HrMsg msg = new HrMsg();
            Date date = new Date();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String format = sdf.format(date);
            msg.setTime(format);
            msg.setType(16);
            msg.setStatus(1);
            msg.setStoreId(32872);
            Map map = new HashMap();
            map.put("spuId", goods.getId());
            List list = new ArrayList();
            list.add(goods.getId());
            map.put("skuId", list);
            msg.setResult(JSON.toJSONString(map));
            msg.insert();
        }
    }

    @PostMapping("/jiangsu")
    @ApiOperation(value = "添加江苏商品到大池 再到店铺")
    public void jiangsu() throws Exception {
        String filepath = "D:\\(第二批)批量上架导入表2022.04.28.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 12);
        for (int i = 1; i < dataList.size(); i++) {
            System.out.println("num:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(5));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(5));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(6)));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(0);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(8)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(10));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20220311/" + dataList.get(i).get(0) + "-" + j + "JSS.jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            Goodsbrand goodsbrand = new Goodsbrand().selectById(dataList.get(i).get(2));
            if (goodsbrand == null) {
                List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                        .eq(Goodsbrand::getName, dataList.get(i).get(2)).eq(Goodsbrand::getUserId, 33012));
                if (goodsbrands.size() < 1) {
                    Goodsbrand goodsbrand1 = new Goodsbrand();
                    goodsbrand1.setAddTime(new Date());
                    goodsbrand1.setDeleteStatus(false);
                    goodsbrand1.setAudit(true);
                    goodsbrand1.setName(dataList.get(i).get(2));
                    goodsbrand1.setRecommend(false);
                    goodsbrand1.setSequence(1);
                    goodsbrand1.setUserId(33012L);
                    goodsbrand1.insert();
                    goods.setGoodsBrandId(goodsbrand1.getId());
                } else {
                    goods.setGoodsBrandId(goodsbrands.get(0).getId());
                }
            } else {
                goods.setGoodsBrandId(Long.valueOf(dataList.get(i).get(2)));
            }
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(8)));
            goods.setCode(dataList.get(i).get(4));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(11));
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "-1JS.jpg");
            accessory.setPath("uploadfile/store/32784/2022/03/11");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(9));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "-1JS.jpg");
                accessory1.setPath("uploadfile/store/32784/2022/03/11");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 2; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "-" + k + "JS.jpg");
                    accessory2.setPath("uploadfile/store/32784/2022/03/11");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }

            //添加江苏商品从大池到店铺
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(goods, newGoods);
            newGoods.setDachiGoods(goods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32870L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            down down1 = new down();
            down1.setId(String.valueOf(newGoods.getId()));
            down1.insert();
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(3)));
            goodsUgc.insert();

            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(9));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "-1JS.jpg");
                accessory3.setPath("uploadfile/store/32784/2022/03/11");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(32811L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "-" + j + "JS.jpg");
                    accessory4.setPath("uploadfile/store/32784/2022/03/11");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(32811L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }

        }
    }

    @PostMapping("/jiajiangsu")
    @ApiOperation(value = "添加江苏用户")
    public void jiajiangsu() throws Exception {
        String filepath = "D:\\123.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 11500; i < dataList.size(); i++) {
            User userone = new User().selectOne(new LambdaQueryWrapper<User>().eq(User::getAgencyCode, dataList.get(i).get(1)));
            if (userone == null) {
                User userold = new User().selectById(128193);
                User user = new User();
                BeanUtils.copyProperties(userold, user);
                user.setId(null);
                user.setAddTime(new Date());
                user.setEmail("jszc");
                user.setPassword("be5f49922d2bb64f60b7f72880c473b5");
                String userName = dataList.get(i).get(0) + Math.round((Math.random() + 1) * 1000);
                user.setUserName(userName);
                user.setTrueName(userName);
                user.setAgencyCode(dataList.get(i).get(1));
                user.insert();
                System.out.println(user.getId() + ":" + user.getUserName());
                Member memberold = new Member().selectById(94547);
                Member member = new Member();
                BeanUtils.copyProperties(memberold, member);
                member.setId(null);
                member.setAddTime(new Date());
                member.setUser(userName);
                member.setPassword("1111qqqq.");
                member.setName(userName);
                member.setEmail("jszc");
                member.insert();
            }
        }
    }

    @PostMapping("/jiafenlei")
    @ApiOperation(value = "新华润添加分类")
    public void jiafenlei() throws Exception {
        String filepath = "D:\\华润E购商品后台类目v1.10-华润分类.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 9);
        for (int i = 0; i < dataList.size(); i++) {
            List<Usergoodsclass> usergoodsclasse1 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                    .eq(Usergoodsclass::getEpointid, dataList.get(i).get(1))
                    .eq(Usergoodsclass::getUserId, 128276));
            if (usergoodsclasse1.size() < 1) {
                Usergoodsclass usergoodsclass = new Usergoodsclass();
                usergoodsclass.setUserId(128276L);
                usergoodsclass.setAddTime(new Date());
                usergoodsclass.setClassName(dataList.get(i).get(0));
                usergoodsclass.setEpointid(dataList.get(i).get(1));
                usergoodsclass.setDeleteStatus(false);
                usergoodsclass.setDisplay(true);
                usergoodsclass.setLevel(0);
                usergoodsclass.setJdzid(0);
                usergoodsclass.setSequence(1);
                usergoodsclass.insert();
                System.out.println(usergoodsclass.getEpointid() + "-" + usergoodsclass.getClassName());
            } else {
                Usergoodsclass uu1 = usergoodsclasse1.get(0).setClassName(dataList.get(i).get(0));
                uu1.insertOrUpdate();
            }
            List<Usergoodsclass> usergoodsclasse2 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                    .eq(Usergoodsclass::getEpointid, dataList.get(i).get(3))
                    .eq(Usergoodsclass::getUserId, 128276));
            if (usergoodsclasse2.size() < 1) {
                List<Usergoodsclass> u1 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                        .eq(Usergoodsclass::getEpointid, dataList.get(i).get(1))
                        .eq(Usergoodsclass::getUserId, 128276));
                Usergoodsclass usergoodsclass = new Usergoodsclass();
                usergoodsclass.setUserId(128276L);
                usergoodsclass.setAddTime(new Date());
                usergoodsclass.setClassName(dataList.get(i).get(2));
                usergoodsclass.setEpointid(dataList.get(i).get(3));
                usergoodsclass.setDeleteStatus(false);
                usergoodsclass.setDisplay(true);
                usergoodsclass.setLevel(1);
                usergoodsclass.setJdzid(0);
                usergoodsclass.setSequence(1);
                usergoodsclass.setParentId(u1.get(0).getId());
                usergoodsclass.insert();
                System.out.println(usergoodsclass.getEpointid() + "-" + usergoodsclass.getClassName());
            } else {
                Usergoodsclass uu2 = usergoodsclasse2.get(0).setClassName(dataList.get(i).get(2));
                uu2.insertOrUpdate();
            }
            List<Usergoodsclass> usergoodsclasse3 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                    .eq(Usergoodsclass::getEpointid, dataList.get(i).get(5))
                    .eq(Usergoodsclass::getUserId, 128276));
            if (usergoodsclasse3.size() < 1) {
                List<Usergoodsclass> u2 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                        .eq(Usergoodsclass::getEpointid, dataList.get(i).get(3))
                        .eq(Usergoodsclass::getUserId, 128276));
                Usergoodsclass usergoodsclass = new Usergoodsclass();
                usergoodsclass.setUserId(128276L);
                usergoodsclass.setAddTime(new Date());
                usergoodsclass.setClassName(dataList.get(i).get(4));
                usergoodsclass.setEpointid(dataList.get(i).get(5));
                usergoodsclass.setDeleteStatus(false);
                usergoodsclass.setDisplay(true);
                usergoodsclass.setLevel(2);
                usergoodsclass.setJdzid(0);
                usergoodsclass.setSequence(1);
                usergoodsclass.setParentId(u2.get(0).getId());
                usergoodsclass.insert();
                System.out.println(usergoodsclass.getEpointid() + "-" + usergoodsclass.getClassName());
            } else {
                Usergoodsclass uu3 = usergoodsclasse3.get(0).setClassName(dataList.get(i).get(4));
                uu3.insertOrUpdate();
            }
            List<Usergoodsclass> usergoodsclasse4 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                    .eq(Usergoodsclass::getEpointid, dataList.get(i).get(7))
                    .eq(Usergoodsclass::getUserId, 128276));
            if (usergoodsclasse4.size() < 1) {
                List<Usergoodsclass> u3 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                        .eq(Usergoodsclass::getEpointid, dataList.get(i).get(5))
                        .eq(Usergoodsclass::getUserId, 128276));
                Usergoodsclass usergoodsclass = new Usergoodsclass();
                usergoodsclass.setUserId(128276L);
                usergoodsclass.setAddTime(new Date());
                usergoodsclass.setClassName(dataList.get(i).get(6));
                usergoodsclass.setEpointid(dataList.get(i).get(7));
                usergoodsclass.setDiscount(dataList.get(i).get(8));
                usergoodsclass.setDeleteStatus(false);
                usergoodsclass.setDisplay(true);
                usergoodsclass.setLevel(3);
                usergoodsclass.setJdzid(0);
                usergoodsclass.setSequence(1);
                usergoodsclass.setParentId(u3.get(0).getId());
                usergoodsclass.insert();
                System.out.println(usergoodsclass.getEpointid() + "-" + usergoodsclass.getClassName());
            } else {
                Usergoodsclass uu4 = usergoodsclasse4.get(0).setClassName(dataList.get(i).get(6));
                uu4.insertOrUpdate();
            }
        }
    }

    @PostMapping("/jiafenleisz")
    @ApiOperation(value = "深圳添加分类")
    public void jiafenleisz() throws Exception {
        String filepath = "D:\\2.品目列表.xls";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 6);
        for (int i = 0; i < dataList.size(); i++) {
            List<Usergoodsclass> usergoodsclasse1 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                    .eq(Usergoodsclass::getEpointid, dataList.get(i).get(1))
                    .eq(Usergoodsclass::getUserId, 186923));
            if (usergoodsclasse1.size() < 1) {
                Usergoodsclass usergoodsclass = new Usergoodsclass();
                usergoodsclass.setUserId(186923L);
                usergoodsclass.setAddTime(new Date());
                usergoodsclass.setClassName(dataList.get(i).get(0));
                usergoodsclass.setEpointid(dataList.get(i).get(1));
                usergoodsclass.setDeleteStatus(false);
                usergoodsclass.setDisplay(true);
                usergoodsclass.setLevel(0);
                usergoodsclass.setJdzid(0);
                usergoodsclass.setSequence(1);
                usergoodsclass.insert();
                System.out.println(usergoodsclass.getEpointid() + "-" + usergoodsclass.getClassName());
            } else {
                Usergoodsclass uu1 = usergoodsclasse1.get(0).setClassName(dataList.get(i).get(0));
                uu1.insertOrUpdate();
            }
            List<Usergoodsclass> usergoodsclasse2 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                    .eq(Usergoodsclass::getEpointid, dataList.get(i).get(3))
                    .eq(Usergoodsclass::getUserId, 186923));
            if (usergoodsclasse2.size() < 1) {
                List<Usergoodsclass> u1 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                        .eq(Usergoodsclass::getEpointid, dataList.get(i).get(1))
                        .eq(Usergoodsclass::getUserId, 186923));
                Usergoodsclass usergoodsclass = new Usergoodsclass();
                usergoodsclass.setUserId(186923L);
                usergoodsclass.setAddTime(new Date());
                usergoodsclass.setClassName(dataList.get(i).get(2));
                usergoodsclass.setEpointid(dataList.get(i).get(3));
                usergoodsclass.setDeleteStatus(false);
                usergoodsclass.setDisplay(true);
                usergoodsclass.setLevel(1);
                usergoodsclass.setJdzid(0);
                usergoodsclass.setSequence(1);
                usergoodsclass.setParentId(u1.get(0).getId());
                usergoodsclass.insert();
                System.out.println(usergoodsclass.getEpointid() + "-" + usergoodsclass.getClassName());
            } else {
                Usergoodsclass uu2 = usergoodsclasse2.get(0).setClassName(dataList.get(i).get(2));
                uu2.insertOrUpdate();
            }
            List<Usergoodsclass> usergoodsclasse3 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                    .eq(Usergoodsclass::getEpointid, dataList.get(i).get(5))
                    .eq(Usergoodsclass::getUserId, 186923));
            if (usergoodsclasse3.size() < 1) {
                List<Usergoodsclass> u2 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                        .eq(Usergoodsclass::getEpointid, dataList.get(i).get(3))
                        .eq(Usergoodsclass::getUserId, 186923));
                Usergoodsclass usergoodsclass = new Usergoodsclass();
                usergoodsclass.setUserId(186923L);
                usergoodsclass.setAddTime(new Date());
                usergoodsclass.setClassName(dataList.get(i).get(4));
                usergoodsclass.setEpointid(dataList.get(i).get(5));
                usergoodsclass.setDeleteStatus(false);
                usergoodsclass.setDisplay(true);
                usergoodsclass.setLevel(2);
                usergoodsclass.setJdzid(0);
                usergoodsclass.setSequence(1);
                usergoodsclass.setParentId(u2.get(0).getId());
                usergoodsclass.insert();
                System.out.println(usergoodsclass.getEpointid() + "-" + usergoodsclass.getClassName());
            } else {
                Usergoodsclass uu3 = usergoodsclasse3.get(0).setClassName(dataList.get(i).get(4));
                uu3.insertOrUpdate();
            }
        }
    }

    @PostMapping("/jiadizhi")
    @ApiOperation(value = "江苏加地址")
    public void jiadizhi() throws Exception {
        String filepath = "D:\\江苏地址编码.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 6);
        for (int i = 0; i < dataList.size(); i++) {
            List<JiangsuArea> jiangsuAreas1 = new JiangsuArea().selectList(new LambdaQueryWrapper<JiangsuArea>()
                    .eq(JiangsuArea::getAddressId, dataList.get(i).get(0))
                    .eq(JiangsuArea::getAddressName, dataList.get(i).get(1)));
            if (jiangsuAreas1.size() < 1) {
                JiangsuArea jiangsuArea = new JiangsuArea();
                jiangsuArea.setAddressId(dataList.get(i).get(0));
                jiangsuArea.setAddressName(dataList.get(i).get(1));
                jiangsuArea.insert();
                System.out.println(jiangsuArea.getAddressId() + "-" + jiangsuArea.getAddressName());
            }
            List<JiangsuArea> jiangsuAreas2 = new JiangsuArea().selectList(new LambdaQueryWrapper<JiangsuArea>()
                    .eq(JiangsuArea::getAddressId, dataList.get(i).get(2))
                    .eq(JiangsuArea::getAddressName, dataList.get(i).get(3)));
            if (jiangsuAreas2.size() < 1) {
                List<JiangsuArea> j1 = new JiangsuArea().selectList(new LambdaQueryWrapper<JiangsuArea>()
                        .eq(JiangsuArea::getAddressId, dataList.get(i).get(0))
                        .eq(JiangsuArea::getAddressName, dataList.get(i).get(1)));
                JiangsuArea jiangsuArea = new JiangsuArea();
                jiangsuArea.setAddressId(dataList.get(i).get(2));
                jiangsuArea.setAddressName(dataList.get(i).get(3));
                jiangsuArea.setAddressPid(j1.get(0).getAddressId());
                jiangsuArea.insert();
                System.out.println(jiangsuArea.getAddressId() + "-" + jiangsuArea.getAddressName());
            }
            List<JiangsuArea> jiangsuAreas3 = new JiangsuArea().selectList(new LambdaQueryWrapper<JiangsuArea>()
                    .eq(JiangsuArea::getAddressId, dataList.get(i).get(4))
                    .eq(JiangsuArea::getAddressName, dataList.get(i).get(5)));
            if (jiangsuAreas3.size() < 1) {
                List<JiangsuArea> j2 = new JiangsuArea().selectList(new LambdaQueryWrapper<JiangsuArea>()
                        .eq(JiangsuArea::getAddressId, dataList.get(i).get(2))
                        .eq(JiangsuArea::getAddressName, dataList.get(i).get(3)));
                JiangsuArea jiangsuArea = new JiangsuArea();
                jiangsuArea.setAddressId(dataList.get(i).get(4));
                jiangsuArea.setAddressName(dataList.get(i).get(5));
                jiangsuArea.setAddressPid(j2.get(0).getAddressId());
                jiangsuArea.insert();
                System.out.println(jiangsuArea.getAddressId() + "-" + jiangsuArea.getAddressName());
            }
        }
    }

    @PostMapping("/jiafenleiahsn")
    @ApiOperation(value = "安徽水安添加分类")
    public void jiafenleiahsn() throws Exception {
        String filepath = "D:\\整理后的分类.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 9);
        for (int i = 0; i < dataList.size(); i++) {
            List<Usergoodsclass> usergoodsclasse1 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                    .eq(Usergoodsclass::getEpointid, dataList.get(i).get(2))
                    .eq(Usergoodsclass::getClassName, dataList.get(i).get(0))
                    .eq(Usergoodsclass::getUserId, 186777));
            if (usergoodsclasse1.size() < 1) {
                Usergoodsclass usergoodsclass = new Usergoodsclass();
                usergoodsclass.setUserId(186777L);
                usergoodsclass.setAddTime(new Date());
                usergoodsclass.setClassName(dataList.get(i).get(0));
                usergoodsclass.setEpointid(dataList.get(i).get(2));
                usergoodsclass.setJdzid(Integer.valueOf(dataList.get(i).get(1)));
                usergoodsclass.setDeleteStatus(false);
                usergoodsclass.setDisplay(true);
                usergoodsclass.setLevel(0);
                usergoodsclass.setSequence(1);
                usergoodsclass.insert();
                System.out.println(usergoodsclass.getEpointid() + "-" + usergoodsclass.getClassName());
            }
            List<Usergoodsclass> usergoodsclasse2 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                    .eq(Usergoodsclass::getEpointid, dataList.get(i).get(5))
                    .eq(Usergoodsclass::getClassName, dataList.get(i).get(3))
                    .eq(Usergoodsclass::getUserId, 186777));
            if (usergoodsclasse2.size() < 1) {
                List<Usergoodsclass> u1 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                        .eq(Usergoodsclass::getEpointid, dataList.get(i).get(2))
                        .eq(Usergoodsclass::getClassName, dataList.get(i).get(0))
                        .eq(Usergoodsclass::getUserId, 186777));
                Usergoodsclass usergoodsclass = new Usergoodsclass();
                usergoodsclass.setUserId(186777L);
                usergoodsclass.setAddTime(new Date());
                usergoodsclass.setClassName(dataList.get(i).get(3));
                usergoodsclass.setEpointid(dataList.get(i).get(5));
                usergoodsclass.setJdzid(Integer.valueOf(dataList.get(i).get(4)));
                usergoodsclass.setDeleteStatus(false);
                usergoodsclass.setDisplay(true);
                usergoodsclass.setLevel(1);
                usergoodsclass.setSequence(1);
                usergoodsclass.setParentId(u1.get(0).getId());
                usergoodsclass.insert();
                System.out.println(usergoodsclass.getEpointid() + "-" + usergoodsclass.getClassName());
            }
            List<Usergoodsclass> usergoodsclasse3 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                    .eq(Usergoodsclass::getEpointid, dataList.get(i).get(8))
                    .eq(Usergoodsclass::getClassName, dataList.get(i).get(6))
                    .eq(Usergoodsclass::getUserId, 186777));
            if (usergoodsclasse3.size() < 1) {
                List<Usergoodsclass> u2 = new Usergoodsclass().selectList(new LambdaQueryWrapper<Usergoodsclass>()
                        .eq(Usergoodsclass::getEpointid, dataList.get(i).get(5))
                        .eq(Usergoodsclass::getClassName, dataList.get(i).get(3))
                        .eq(Usergoodsclass::getUserId, 186777));
                Usergoodsclass usergoodsclass = new Usergoodsclass();
                usergoodsclass.setUserId(186777L);
                usergoodsclass.setAddTime(new Date());
                usergoodsclass.setClassName(dataList.get(i).get(6));
                usergoodsclass.setEpointid(dataList.get(i).get(8));
                usergoodsclass.setJdzid(Integer.valueOf(dataList.get(i).get(7)));
                usergoodsclass.setDeleteStatus(false);
                usergoodsclass.setDisplay(true);
                usergoodsclass.setLevel(2);
                usergoodsclass.setSequence(1);
                usergoodsclass.setParentId(u2.get(0).getId());
                usergoodsclass.insert();
                System.out.println(usergoodsclass.getEpointid() + "-" + usergoodsclass.getClassName());
            }
        }
    }

    @PostMapping("/jiafenleishenzhen")
    @ApiOperation(value = "深圳易购添加分类")
    public void jiafenleishenzhen() throws Exception {
        String filepath = "D:\\1(1).xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 3);
        for (int i = 0; i < dataList.size(); i++) {
            Usergoodsclass usergoodsclass = new Usergoodsclass();
            usergoodsclass.setUserId(186919L);
            usergoodsclass.setAddTime(new Date());
            usergoodsclass.setClassName(dataList.get(i).get(1));
            usergoodsclass.setEpointid(dataList.get(i).get(0));
            usergoodsclass.setDiscount(dataList.get(i).get(2));
            usergoodsclass.setJdzid(0);
            usergoodsclass.setDeleteStatus(false);
            usergoodsclass.setDisplay(true);
            usergoodsclass.setLevel(0);
            usergoodsclass.setSequence(1);
            usergoodsclass.insert();
        }
    }


    @PostMapping("/guowangfenlei")
    @ApiOperation(value = "添加国网分类")
    public void guowangfenlei() throws Exception {
        String filepath = "D:\\2023分类添加.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 7);
        for (int i = 0; i < dataList.size(); i++) {
            Usergoodsclass usergoodsclass = new Usergoodsclass();
            usergoodsclass.setUserId(38048L);
            usergoodsclass.setAddTime(new Date());
            usergoodsclass.setClassName(dataList.get(i).get(3));
            usergoodsclass.setEpointid(dataList.get(i).get(4));
            usergoodsclass.setDeleteStatus(false);
            usergoodsclass.setDisplay(true);
            usergoodsclass.setLevel(0);
            usergoodsclass.setJdzid(0);
            usergoodsclass.setSequence(1);
            usergoodsclass.setGuowangBianma(dataList.get(i).get(0));
            usergoodsclass.setGuowangWuliaoName(dataList.get(i).get(1));
            usergoodsclass.setGuowangCategory(dataList.get(i).get(2));
            usergoodsclass.setNanwangCat(dataList.get(i).get(5));
            usergoodsclass.setDiscount(dataList.get(i).get(6));
            usergoodsclass.insert();
            System.out.println(usergoodsclass.getClassName());
        }
    }

    @PostMapping("/sgfenlei")
    @ApiOperation(value = "添加省管分类")
    public void sgfenlei() throws Exception {
        String filepath = "D:\\新建 Microsoft Excel 工作表.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 5);
        for (int i = 1; i < dataList.size(); i++) {
            Usergoodsclass usergoodsclass = new Usergoodsclass();
            usergoodsclass.setUserId(38255L);
            usergoodsclass.setAddTime(new Date());
            usergoodsclass.setClassName(dataList.get(i).get(0));
            usergoodsclass.setEpointid(dataList.get(i).get(1));
            usergoodsclass.setDeleteStatus(false);
            usergoodsclass.setDisplay(true);
            usergoodsclass.setLevel(0);
            usergoodsclass.setJdzid(0);
            usergoodsclass.setSequence(1);
            usergoodsclass.setGuowangBianma(dataList.get(i).get(3));
            usergoodsclass.setGuowangWuliaoName(dataList.get(i).get(2));
            usergoodsclass.setGuowangCategory(dataList.get(i).get(1));
            usergoodsclass.setDiscount(new BigDecimal(dataList.get(i).get(4))
                    .setScale(4, BigDecimal.ROUND_HALF_UP).toString());
            usergoodsclass.insert();
            System.out.println(usergoodsclass.getClassName());
        }
    }

    @PostMapping("/sggaifenlei")
    @ApiOperation(value = "添加省管分类")
    public void sggaifenlei() throws Exception {
        String filepath = "D:\\省管改类目ID.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            boolean delete = new GoodsUgc().delete(new LambdaQueryWrapper<GoodsUgc>()
                    .eq(GoodsUgc::getGoodsId, dataList.get(i).get(0)));
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(Long.valueOf(dataList.get(i).get(0)));
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(1)));
            goodsUgc.insert();
            System.out.println(i);
        }
    }

    @PostMapping("/guowangpinpaitian")
    @ApiOperation(value = "添加国网品牌")
    public void guowangpinpaitian() throws Exception {
        String filepath = "D:\\加品牌.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 2);
        for (int i = 0; i < dataList.size(); i++) {
            Goodsbrand goodsbrand1 = new Goodsbrand();
            goodsbrand1.setAddTime(new Date());
            goodsbrand1.setDeleteStatus(false);
            goodsbrand1.setAudit(true);
            goodsbrand1.setName(dataList.get(i).get(0));
            goodsbrand1.setRecommend(false);
            goodsbrand1.setSequence(1);
            goodsbrand1.setUserId(38048L);
            goodsbrand1.setGuowangEpoint(dataList.get(i).get(1));
            goodsbrand1.insert();
            System.out.println(dataList.get(i).get(0));
        }
    }

    @PostMapping("/gaidachitupian")
    @ApiOperation(value = "改大池图片")
    public void guowanggaizizhi() throws Exception {
        String filepath = "D:\\无标题.xls";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 1);
        for (int i = 0; i < dataList.size(); i++) {
            Goods goods = new Goods().selectById(dataList.get(i).get(0));
            Goods dachi = new Goods().selectById(goods.getDachiGoods());
            if (dachi != null) {
                new GoodsPhoto().delete(new LambdaQueryWrapper<GoodsPhoto>().eq(GoodsPhoto::getGoodsId, dachi.getId()));
                List<GoodsPhoto> goodsPhotos = new GoodsPhoto().selectList(new LambdaQueryWrapper<GoodsPhoto>()
                        .eq(GoodsPhoto::getGoodsId, goods.getId()));
                for (GoodsPhoto goodsPhoto : goodsPhotos) {
                    GoodsPhoto photo = new GoodsPhoto();
                    photo.setPhotoId(goodsPhoto.getPhotoId());
                    photo.setGoodsId(dachi.getId());
                    photo.insert();
                }
//                dachi.setGoodsDetails(goods.getGoodsDetails());
                dachi.setGoodsMainPhotoId(goods.getGoodsMainPhotoId());
//                dachi.setGoodsPrice(new BigDecimal(dataList.get(i).get(2)));
//                dachi.setStorePrice(new BigDecimal(dataList.get(i).get(2)));
//                dachi.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(2)));
//                List list = new ArrayList();
//                Map map = new HashMap();
//                map.put("id", "32768_");
//                map.put("safeinventory", dachi.getGoodsSafeInventory().toString());
//                map.put("price", dachi.getStorePrice().toString());
//                map.put("count", dachi.getGoodsInventory().toString());
//                map.put("barcode", dachi.getBarCode() == null ? 0 : dachi.getBarCode());
//                map.put("goodsserial", "");
//                map.put("colgoodscode", dachi.getCode() + "01");
//                map.put("promprice", 0);
//                map.put("erpid", "");
//                list.add(map);
//                String s = JsonUtils.obj2string(list);
//                dachi.setGoodsInventoryDetail(s);
                dachi.setGoodsStatus(0);
                dachi.insertOrUpdate();
                System.out.println(dachi.getId());
            }
        }
    }

    @PostMapping("/huarunkaipiao")
    @ApiOperation(value = "华润开票")
    public void huarunkaipiao() throws Exception {
        String filepath = "D:\\新建 Microsoft Excel 工作表.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 3);
        for (int i = 0; i < dataList.size(); i++) {
            Orderform orderform = new Orderform().selectOne(new LambdaQueryWrapper<Orderform>()
                    .eq(Orderform::getOrderId, dataList.get(i).get(0)));
            List<SpClientBillingapply> spClientBillingapplies = new SpClientBillingapply().selectList(new LambdaQueryWrapper<SpClientBillingapply>()
                    .eq(SpClientBillingapply::getInvoiceNo, orderform.getOrderId()));
            if (spClientBillingapplies.size() < 1) {

                SpClientBillingapply spClientBillingapply = new SpClientBillingapply();
                spClientBillingapply.setAddTime(new Date());
                spClientBillingapply.setInvoiceNo(orderform.getOrderId());
                spClientBillingapply.setMakeinvoiceDate(new Date());
                spClientBillingapply.setInvoiceType("VATSpecialInvoice");
                List<Client> clients = new Client().selectList(new LambdaQueryWrapper<Client>()
                        .eq(Client::getClientname, orderform.getClientname())
                        .orderByDesc(Client::getId));
                //倒叙拿到第一个
                Client client = clients.get(0);
                spClientBillingapply.setClientname(client.getClientname());
                spClientBillingapply.setClientAccountNumber(client.getAccountNumber());
                spClientBillingapply.setClientDutyParagraph(client.getDutyParagraph());
                spClientBillingapply.setSpUsername("xhrfuwushang");
                spClientBillingapply.setTotalprice(orderform.getGoodsAmount());
                spClientBillingapply.setOrderInvoiceNo(dataList.get(i).get(1));
                spClientBillingapply.setInvoiceStatus("1");
                spClientBillingapply.setInvoiceType("client");
                spClientBillingapply.setBillingclientname(client.getClientname());
                spClientBillingapply.setOpeningBank(client.getOpeningBank());
                spClientBillingapply.setBillingAddress(client.getBillingAddress());
                spClientBillingapply.setMailingAddress(client.getMailingAddress());
                spClientBillingapply.setClientContactsphone(client.getContactsphone());
                spClientBillingapply.setJdFphm(dataList.get(i).get(1));
                spClientBillingapply.setJdFpdm(dataList.get(i).get(2));
                spClientBillingapply.setDeleteStatus(false);
                spClientBillingapply.insert();

                List<Goodscart> goodscarts = new Goodscart().selectList(new LambdaQueryWrapper<Goodscart>()
                        .eq(Goodscart::getOfId, orderform.getId()));
                for (Goodscart goodscart : goodscarts) {
                    SpClientBillingapplyinfo spClientBillingapplyinfo = new SpClientBillingapplyinfo();
                    spClientBillingapplyinfo.setAddTime(new Date());
                    spClientBillingapplyinfo.setSp_c_billingapply_id(spClientBillingapply.getId());
                    spClientBillingapplyinfo.setOf_id(orderform.getId());
                    spClientBillingapplyinfo.setOf_addTime(orderform.getAddTime());
                    spClientBillingapplyinfo.setGoods_id(goodscart.getGoodsId());
                    Goods goods = new Goods().selectById(goodscart.getGoodsId());
                    spClientBillingapplyinfo.setGoods_name(goods.getGoodsName());
                    spClientBillingapplyinfo.setBilling_goods_name(goods.getGoodsName());
                    spClientBillingapplyinfo.setBilling_specification(goods.getCode());
                    spClientBillingapplyinfo.setGoods_count(goodscart.getCount());
                    spClientBillingapplyinfo.setGoods_price(goodscart.getPrice());
                    spClientBillingapplyinfo.setTaxrate(BigDecimal.valueOf(0.13));
                    spClientBillingapplyinfo.setSpd(BigDecimal.valueOf(1.00));
                    List<GoodsUgc> goodsUgcs = new GoodsUgc().selectList(new LambdaQueryWrapper<GoodsUgc>()
                            .eq(GoodsUgc::getGoodsId, goods.getId()));
                    spClientBillingapplyinfo.setGoods_top_ugc_id(goodsUgcs.get(0).getClassId());
                    BigDecimal multiply = BigDecimal.valueOf(goodscart.getCount())
                            .multiply(goodscart.getPrice());
                    spClientBillingapplyinfo.setInfo_totalprice(multiply);
                    spClientBillingapplyinfo.setGoodscart_id(goodscart.getId());
                    spClientBillingapplyinfo.setSp_spd(BigDecimal.valueOf(1.00));
                    spClientBillingapplyinfo.setSp_info_totalprice(multiply);
                    spClientBillingapplyinfo.setGoods_unit(goods.getMinUnit());
                    BigDecimal divide = multiply.divide(new BigDecimal(1.13), 2);
                    spClientBillingapplyinfo.setWsje(divide);
                    spClientBillingapplyinfo.setSe(multiply.subtract(divide));
                    spClientBillingapplyinfo.setDeleteStatus(false);
                    spClientBillingapplyinfo.insert();
                }

            }
        }
    }

    @PostMapping("/updatepicname")
    @ApiOperation(value = "修改图片名")
    public void updatepicname(@RequestParam String url, @RequestParam String oldname, @RequestParam String newname) throws Exception {
        String host = "121.41.78.226"; // 替换为你的服务器主机名或IP地址
        String user = "root"; // 替换为你的SSH用户名
        String password = "EMPYM8V$F8^Ot"; // 替换为你的SSH密码（或者使用密钥认证）
        int port = 22; // 默认的SSH端口是22，如果不同请更改
        String oldFileName = url + oldname; // 替换为服务器上旧图片的路径
        String newFileName = url + newname; // 替换为新的图片路径和名称

        try {
            JSch jsch = new JSch();
            Session session = jsch.getSession(user, host, port);
            session.setPassword(password);

            // 禁用主机密钥检查（仅用于测试，生产环境中应该启用并检查主机密钥）
            java.util.Properties config = new java.util.Properties();
            config.put("StrictHostKeyChecking", "no");
            session.setConfig(config);

            session.connect();

            ChannelExec channelExec = (ChannelExec) session.openChannel("exec");
            InputStream in = channelExec.getInputStream();

            // 构建重命名命令（以Linux为例）
            String command = "mv " + oldFileName + " " + newFileName;
            channelExec.setCommand(command);

            channelExec.connect();

            // 读取命令执行结果
            byte[] tmp = new byte[1024];
            while (true) {
                while (in.available() > 0) {
                    int i = in.read(tmp, 0, 1024);
                    if (i < 0) break;
                    System.out.print(new String(tmp, 0, i));
                }
                if (channelExec.isClosed()) {
                    if (in.available() > 0) continue;
                    System.out.println("exit-status: " + channelExec.getExitStatus());
                    break;
                }
                try {
                    Thread.sleep(1000);
                } catch (Exception ee) {
                    ee.printStackTrace();
                }
            }

            channelExec.disconnect();
            session.disconnect();
        } catch (JSchException | IOException e) {
            e.printStackTrace();
        }
    }


    @PostMapping("/xiazai")
    public void xiazai(@RequestParam String tupianurl, @RequestParam String name,
                       @RequestParam String xiazaiurl) throws Exception {
        // 构造URL
        URL url = new URL(tupianurl);
        // 打开连接
        URLConnection con = url.openConnection();
        // 输入流
        InputStream is = con.getInputStream();
        // 1K的数据缓冲
        byte[] bs = new byte[1024];
        // 读取到的数据长度
        int len;
        // 输出的文件流
        String filename = xiazaiurl + name;  //下载路径及下载图片名称
        File file = new File(filename);
        FileOutputStream os = new FileOutputStream(file, true);
        // 开始读取
        while ((len = is.read(bs)) != -1) {
            os.write(bs, 0, len);
        }
        System.out.println(name);
        // 完毕，关闭所有链接
        os.close();
        is.close();
    }

    @RequestMapping("/pic")
    public void pic() {
        try {
            URL url = new URL("https://api.guangbo.net:10039/uploads/guowangPdf/distribution_clone/2024-03-29/202403290000003039_d.pdf");
            // 打开一个到该URL的连接并获取输入流
            InputStream inputStream = url.openStream();

            // 使用输入流加载PDF文档
            PDDocument document = PDDocument.load(inputStream);

            // 加载PDF文档
//            PDDocument document = PDDocument.load(new File("https://api.guangbo.net:10039/uploads/guowangPdf/receipt_clone/2024-03-14/202403140000005030_r.pdf"));

            // 创建PDF文本提取器
            PDFTextStripper pdfStripper = new PDFTextStripper();

            // 获取PDF文件中的文本
            String text = pdfStripper.getText(document);
            String start = "联系人/电话";
            String end = "供应商";
            int startIndex = text.indexOf(start) + start.length();
            int endIndex = text.indexOf(end);
            String result = text.substring(startIndex, endIndex).trim();
            System.out.println(result);
//            System.out.println(text);

            // 关闭文档
            document.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @PostMapping("/xiugaihuarun")
    public void xiugaihuarun() throws Exception {
        String filepath = "D:\\副本第一批批量表格录入1.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 3);
        for (int i = 0; i < dataList.size(); i++) {
            //先生成商品
            List<Goods> goods = new Goods().selectList(new LambdaQueryWrapper<Goods>()
                    .eq(Goods::getGoodsName, dataList.get(i).get(1)));
            for(Goods good:goods){
                new GoodsPhoto().delete(new LambdaQueryWrapper<GoodsPhoto>()
                        .eq(GoodsPhoto::getGoodsId, good.getId()));
                System.out.println("goodsid:" + good.getId());
                //新增主图图片
                Accessory accessory = new Accessory();
                accessory.setAddTime(new Date());
                accessory.setDeleteStatus(false);
                accessory.setExt("jpg");
                accessory.setSize(Float.valueOf(0));
                accessory.setHeight(800);
                accessory.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory.setPath("uploadfile/store/32784/2124/01/01");
                accessory.setWidth(800);
                accessory.setAlbumId(39L);
                accessory.setUserId(32811L);
                accessory.insert();
                //更新商品中的主图
                good.setGoodsMainPhotoId(accessory.getId());
                good.insertOrUpdate();
                Integer mainnum = Integer.valueOf(dataList.get(i).get(2));
                for (int k = 1; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "_" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2124/01/01");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(good.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }
        }
    }

    @PostMapping("/guodiantou")
    @ApiOperation(value = "添加国电投商品到大池 再到店铺")
    public void guodiantou() throws Exception {
        String filepath = "D:\\大池导入模版 - 欣彩.xlsx";//D盘下的file文件夹的目录
        File file = new File(filepath);//File类型可以是文件也可以是文件夹
        //将MultipartFile转换为File类型
        List<Map<Integer, String>> dataList = ExcelImport.read(file, 13);
        for (int i = 0; i < dataList.size(); i++) {
            System.out.println("num:" + dataList.get(i).get(0) + ",name:" + dataList.get(i).get(3));
            //先生成商品
            Goods goods = new Goods();
            goods.setAddTime(new Date());
            goods.setDeleteStatus(false);
            goods.setGoodsClick(0);
            goods.setGoodsInventory(1000);
            goods.setGoodsName(dataList.get(i).get(3));
            goods.setGoodsPrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setBarCode(dataList.get(i).get(7));
            goods.setCode(dataList.get(i).get(2));
            goods.setGoodsRecommend(true);
            goods.setGoodsSafeInventory(50);
            goods.setGoodsSalenum(0);
            goods.setGoodsStatus(1);
            goods.setGoodsTransfee(1);
            goods.setInventoryType("spec");
            goods.setStorePrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setStoreRecommend(false);
            goods.setZtcClickNum(0);
            goods.setZtcDredgePrice(0);
            goods.setZtcGold(0);
            goods.setZtcPayStatus(0);
            goods.setZtcPrice(0);
            goods.setZtcStatus(0);
            goods.setIsShow(1);
            goods.setGcId(Long.valueOf(dataList.get(i).get(1)));
            String detail = "";
            Integer detailnum = Integer.valueOf(dataList.get(i).get(9));
            for (int j = 1; j <= detailnum; j++) {
                detail = detail + "<img src=\"https://btob.guangbo.net/uploadfile/all/image/20231012/" + dataList.get(i).get(0) + "_" + j + ".jpg\" alt=\"\" />";
            }
            goods.setGoodsDetails(detail);
            List<Goodsbrand> goodsbrands = new Goodsbrand().selectList(new LambdaQueryWrapper<Goodsbrand>()
                    .eq(Goodsbrand::getName, dataList.get(i).get(9)).eq(Goodsbrand::getUserId, 32811));
            if (goodsbrands.size() < 1) {
                Goodsbrand goodsbrand1 = new Goodsbrand();
                goodsbrand1.setAddTime(new Date());
                goodsbrand1.setDeleteStatus(false);
                goodsbrand1.setAudit(true);
                goodsbrand1.setName(dataList.get(i).get(10));
                goodsbrand1.setRecommend(false);
                goodsbrand1.setSequence(1);
                goodsbrand1.setUserId(32811L);
                goodsbrand1.insert();
                goods.setGoodsBrandId(goodsbrand1.getId());
            } else {
                goods.setGoodsBrandId(goodsbrands.get(0).getId());
            }
            goods.setGoodsStoreId(32784L);
            goods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(4)));
            goods.setPhpid(-1L);
            goods.setMinUnit(dataList.get(i).get(6));
            //维护freeparam字段
            List list1 = new ArrayList();
            Map map1 = new HashMap();
            map1.put("paramName", "");
            map1.put("paramValue", "");
            map1.put("paramType", "String");
            list1.add(map1);
            String freeparam = JsonUtils.obj2string(list1);
            goods.setFreeparam(freeparam);
            goods.insert();
            //维护InventoryDetail字段
            List list = new ArrayList();
            Map map = new HashMap();
            map.put("id", "32768_");
            map.put("safeinventory", goods.getGoodsSafeInventory().toString());
            map.put("price", goods.getStorePrice().toString());
            map.put("count", goods.getGoodsInventory().toString());
            map.put("barcode", goods.getBarCode() == null ? 0 : goods.getBarCode());
            map.put("goodsserial", "");
            map.put("colgoodscode", goods.getCode() + "01");
            map.put("promprice", 0);
            map.put("erpid", "");
            list.add(map);
            String s = JsonUtils.obj2string(list);
            goods.setGoodsInventoryDetail(s);
            goods.insertOrUpdate();
            System.out.println("goodsid:" + goods.getId());
            //新增主图图片
            Accessory accessory = new Accessory();
            accessory.setAddTime(new Date());
            accessory.setDeleteStatus(false);
            accessory.setExt("jpg");
            accessory.setSize(Float.valueOf(0));
            accessory.setHeight(800);
            accessory.setName(dataList.get(i).get(0) + "_1.jpg");
            accessory.setPath("uploadfile/store/32784/2023/10/12");
            accessory.setWidth(800);
            accessory.setAlbumId(39L);
            accessory.setUserId(32811L);
            accessory.insert();
            //更新商品中的主图
            goods.setGoodsMainPhotoId(accessory.getId());
            goods.insertOrUpdate();

            Integer mainnum = Integer.valueOf(dataList.get(i).get(8));
            if (mainnum == 1) {
                Accessory accessory1 = new Accessory();
                accessory1.setAddTime(new Date());
                accessory1.setDeleteStatus(false);
                accessory1.setSize(Float.valueOf(0));
                accessory1.setExt("jpg");
                accessory1.setHeight(800);
                accessory1.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory1.setPath("uploadfile/store/32784/2023/10/12");
                accessory1.setWidth(800);
                accessory1.setAlbumId(39L);
                accessory1.setUserId(32811L);
                accessory1.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(goods.getId());
                goodsPhoto1.setPhotoId(accessory1.getId());
                goodsPhoto1.insert();
            } else {
                for (int k = 1; k <= mainnum; k++) {
                    Accessory accessory2 = new Accessory();
                    accessory2.setAddTime(new Date());
                    accessory2.setDeleteStatus(false);
                    accessory2.setSize(Float.valueOf(0));
                    accessory2.setExt("jpg");
                    accessory2.setHeight(800);
                    accessory2.setName(dataList.get(i).get(0) + "_" + k + ".jpg");
                    accessory2.setPath("uploadfile/store/32784/2023/10/12");
                    accessory2.setWidth(800);
                    accessory2.setAlbumId(39L);
                    accessory2.setUserId(32811L);
                    accessory2.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(goods.getId());
                    goodsPhoto1.setPhotoId(accessory2.getId());
                    goodsPhoto1.insert();
                }
            }

            //添加国电投商品从大池到店铺
            Goods newGoods = new Goods();
            BeanUtils.copyProperties(goods, newGoods);
            newGoods.setDachiGoods(goods.getId());
            newGoods.setPhpid(-1L);
            newGoods.setGoodsStoreId(32907L);
            newGoods.setId(null);
            newGoods.setGoodsStatus(0);
            newGoods.setAddTime(new Date());
            newGoods.insert();
            System.out.println("newid:" + newGoods.getId());
            newGoods.setStorePrice(new BigDecimal(dataList.get(i).get(5)));
            newGoods.setGoodsCurrentPrice(new BigDecimal(dataList.get(i).get(5)));
            //维护InventoryDetail字段
            List lists = new ArrayList();
            Map maps = new HashMap();
            maps.put("id", "32768_");
            maps.put("safeinventory", newGoods.getGoodsSafeInventory().toString());
            maps.put("price", newGoods.getStorePrice().toString());
            maps.put("count", newGoods.getGoodsInventory().toString());
            maps.put("barcode", newGoods.getBarCode() == null ? 0 : newGoods.getBarCode());
            maps.put("goodsserial", "");
            maps.put("colgoodscode", goods.getCode() + "01");
            maps.put("promprice", 0);
            maps.put("erpid", "");
            lists.add(maps);
            String s1 = JsonUtils.obj2string(lists);
            newGoods.setGoodsInventoryDetail(s1);
            newGoods.insertOrUpdate();
            down down1 = new down();
            down1.setId(String.valueOf(newGoods.getId()));
            down1.setGid(String.valueOf(goods.getId()));
            down1.insert();
            //设置分类
            GoodsUgc goodsUgc = new GoodsUgc();
            goodsUgc.setGoodsId(newGoods.getId());
            goodsUgc.setClassId(Long.valueOf(dataList.get(i).get(12)));
            goodsUgc.insert();

            //创建图片商品中间表
            Integer mainnum1 = Integer.valueOf(dataList.get(i).get(8));
            if (mainnum1 == 1) {
                Accessory accessory3 = new Accessory();
                accessory3.setAddTime(new Date());
                accessory3.setDeleteStatus(false);
                accessory3.setSize(Float.valueOf(0));
                accessory3.setExt("jpg");
                accessory3.setHeight(800);
                accessory3.setName(dataList.get(i).get(0) + "_1.jpg");
                accessory3.setPath("uploadfile/store/32784/2023/10/12");
                accessory3.setWidth(800);
                accessory3.setAlbumId(39L);
                accessory3.setUserId(32811L);
                accessory3.insert();
                //创建图片商品中间表
                GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                goodsPhoto1.setGoodsId(newGoods.getId());
                goodsPhoto1.setPhotoId(accessory3.getId());
                goodsPhoto1.insert();
            } else {
                for (int j = 2; j <= mainnum1; j++) {
                    Accessory accessory4 = new Accessory();
                    accessory4.setAddTime(new Date());
                    accessory4.setDeleteStatus(false);
                    accessory4.setSize(Float.valueOf(0));
                    accessory4.setExt("jpg");
                    accessory4.setHeight(800);
                    accessory4.setName(dataList.get(i).get(0) + "_" + j + ".jpg");
                    accessory4.setPath("uploadfile/store/32784/2023/10/12");
                    accessory4.setWidth(800);
                    accessory4.setAlbumId(39L);
                    accessory4.setUserId(32811L);
                    accessory4.insert();
                    //创建图片商品中间表
                    GoodsPhoto goodsPhoto1 = new GoodsPhoto();
                    goodsPhoto1.setGoodsId(newGoods.getId());
                    goodsPhoto1.setPhotoId(accessory4.getId());
                    goodsPhoto1.insert();
                }
            }

        }
    }
}

